diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-02-15 19:02:34 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:22 +0000 |
commit | e786b96b66bdf71b86875fc3aa3e8ad056c4534a (patch) | |
tree | 2102c901ea70e3577577eaa39af0233bce5fe592 | |
parent | 5d33016242bab40523890f85f1838db7323e97b8 (diff) |
Fix Division by Zero in interpolated scaler.
If we find we are scaling an image to be zero width or
height, handle the image without interpolation.
-rw-r--r-- | gs/base/gxiscale.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gs/base/gxiscale.c b/gs/base/gxiscale.c index ff225ae4e..1975c65fd 100644 --- a/gs/base/gxiscale.c +++ b/gs/base/gxiscale.c @@ -159,6 +159,11 @@ gs_image_class_0_interpolate(gx_image_enum * penum) iss.EntireHeightIn = penum->Height; iss.EntireWidthOut = fixed2int_pixround(any_abs(penum->dst_width)); iss.EntireHeightOut = fixed2int_pixround(any_abs(penum->dst_height)); + if (iss.EntireWidthOut == 0 || iss.EntireHeightOut == 0) + { + penum->interpolate = false; + return 0; + } /* If we are in an indexed space then we need to use the number of components in the base space. Otherwise we use the number of components in the source space */ if (pcs->type->index == gs_color_space_index_Indexed) { |