mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
fix dereference before checking for NULL in the ImagingTransformAffine
function
The `imIn` pointer is checked for `NULL`, but it seems to be dereferenced before this check. You must first make sure that the pointer is not `NULL` before using it.
This commit is contained in:
parent
0f47ecd432
commit
46f2fa17be
|
@ -1035,6 +1035,10 @@ ImagingTransformAffine(
|
|||
double xx, yy;
|
||||
double xo, yo;
|
||||
|
||||
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) {
|
||||
return (Imaging)ImagingError_ModeError();
|
||||
}
|
||||
|
||||
if (filterid || imIn->type == IMAGING_TYPE_SPECIAL) {
|
||||
return ImagingGenericTransform(
|
||||
imOut, imIn, x0, y0, x1, y1, affine_transform, a, filterid, fill
|
||||
|
@ -1046,10 +1050,6 @@ ImagingTransformAffine(
|
|||
return ImagingScaleAffine(imOut, imIn, x0, y0, x1, y1, a, fill);
|
||||
}
|
||||
|
||||
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) {
|
||||
return (Imaging)ImagingError_ModeError();
|
||||
}
|
||||
|
||||
if (x0 < 0) {
|
||||
x0 = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user