Skip to content

Commit c6e07d0

Browse files
authored
Merge pull request #8400 from radarhere/geometry
Check image value before use
2 parents ed143f5 + e9f831d commit c6e07d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libImaging/Geometry.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,15 @@ ImagingGenericTransform(
791791
char *out;
792792
double xx, yy;
793793

794+
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) {
795+
return (Imaging)ImagingError_ModeError();
796+
}
797+
794798
ImagingTransformFilter filter = getfilter(imIn, filterid);
795799
if (!filter) {
796800
return (Imaging)ImagingError_ValueError("bad filter number");
797801
}
798802

799-
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) {
800-
return (Imaging)ImagingError_ModeError();
801-
}
802-
803803
ImagingCopyPalette(imOut, imIn);
804804

805805
ImagingSectionEnter(&cookie);

0 commit comments

Comments
 (0)