diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-06 14:42:25 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-01-06 14:45:38 +0000 |
commit | 6dd9108c5865c1ea2ab0e834f4ae85aa279bcca9 (patch) | |
tree | fe3d0a01115cf56f5e9d74c1810094ee2bd8338c /xps/xps_image.c | |
parent | e504b09e060020c6e7d3478f617a24528de4116d (diff) | |
download | mupdf-6dd9108c5865c1ea2ab0e834f4ae85aa279bcca9.tar.xz |
Various fixes to avoid arithmetic problems.
Various fixes to avoid overflow problems, division by zeros, use
of uninitialised variables etc. All from/suggested by Zenikos patch.
Diffstat (limited to 'xps/xps_image.c')
-rw-r--r-- | xps/xps_image.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xps/xps_image.c b/xps/xps_image.c index 6ba017da..85a467af 100644 --- a/xps/xps_image.c +++ b/xps/xps_image.c @@ -28,9 +28,14 @@ xps_paint_image_brush(xps_document *doc, fz_matrix ctm, fz_rect area, char *base xml_element *root, void *vimage) { fz_pixmap *pixmap = vimage; - float xs = pixmap->w * 96 / pixmap->xres; - float ys = pixmap->h * 96 / pixmap->yres; - fz_matrix im = fz_scale(xs, -ys); + float xs, ys; + fz_matrix im; + + if (pixmap->xres == 0 || pixmap->yres == 0) + return; + xs = pixmap->w * 96 / pixmap->xres; + ys = pixmap->h * 96 / pixmap->yres; + im = fz_scale(xs, -ys); im.f = ys; ctm = fz_concat(im, ctm); fz_fill_image(doc->dev, pixmap, ctm, doc->opacity[doc->opacity_top]); |