diff options
author | Alex Cherepanov <alex.cherepanov@artifex.com> | 2013-03-16 09:08:05 -0400 |
---|---|---|
committer | Alex Cherepanov <alex.cherepanov@artifex.com> | 2013-03-16 09:08:05 -0400 |
commit | 56f34c8243ad078882df0f08cbfc10c6943fb3fe (patch) | |
tree | 3850ea7387fc2b247ee13b42aa75a125d6c1812a /gs/base/gxiscale.c | |
parent | 93bcd2277fe838838c760c4fea827d18a445ba8f (diff) | |
download | ghostpdl-56f34c8243ad078882df0f08cbfc10c6943fb3fe.tar.gz |
Bug 693658: Improve validation of image parameters
To avoid overflow, check that parameter is withing the given range
before the parameter is converted to int. Stop interpolation of 0-width
or 0-length images because interpolation code divides by 0 in this case.
Diffstat (limited to 'gs/base/gxiscale.c')
-rw-r--r-- | gs/base/gxiscale.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gs/base/gxiscale.c b/gs/base/gxiscale.c index 9a3f9e219..93fa06bc3 100644 --- a/gs/base/gxiscale.c +++ b/gs/base/gxiscale.c @@ -95,6 +95,10 @@ gs_image_class_0_interpolate(gx_image_enum * penum) penum->interpolate = false; return 0; } + if (penum->Width == 0 || penum->Height == 0) { + penum->interpolate = false; /* No need to interpolate and */ + return 0; /* causes division by 0 if we try. */ + } if ( pcs->cmm_icc_profile_data != NULL ) { use_icc = true; } |