mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-09-20 19:08:58 +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 xx, yy;
|
||||||
double xo, yo;
|
double xo, yo;
|
||||||
|
|
||||||
|
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0) {
|
||||||
|
return (Imaging)ImagingError_ModeError();
|
||||||
|
}
|
||||||
|
|
||||||
if (filterid || imIn->type == IMAGING_TYPE_SPECIAL) {
|
if (filterid || imIn->type == IMAGING_TYPE_SPECIAL) {
|
||||||
return ImagingGenericTransform(
|
return ImagingGenericTransform(
|
||||||
imOut, imIn, x0, y0, x1, y1, affine_transform, a, filterid, fill
|
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);
|
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) {
|
if (x0 < 0) {
|
||||||
x0 = 0;
|
x0 = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user