summaryrefslogtreecommitdiff
path: root/source/fitz/draw-device.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-07-24 17:58:15 +0100
committerRobin Watts <robin.watts@artifex.com>2013-07-24 18:18:43 +0100
commite02d137f205bcf3c5e79128762e6dcff51ad5945 (patch)
treef50e74f4cd76a35f50fa67d1fbb4ff589ae2e574 /source/fitz/draw-device.c
parent3c51806fe29870893aba912297006acdaa141784 (diff)
downloadmupdf-e02d137f205bcf3c5e79128762e6dcff51ad5945.tar.xz
Fix memory overwrites when plotting glyphs that are completely clipped.
This bug has been in here for ages, but was masked by a bug in the gel clipping that was fixed by Tor earlier.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r--source/fitz/draw-device.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index bdafc4d5..00b95e75 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -472,12 +472,16 @@ draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk,
int xorig, int yorig, const fz_irect *scissor)
{
unsigned char *dp, *mp;
- fz_irect bbox;
+ fz_irect bbox, bbox2;
int x, y, w, h;
fz_pixmap_bbox_no_ctx(msk, &bbox);
fz_translate_irect(&bbox, xorig, yorig);
fz_intersect_irect(&bbox, scissor); /* scissor < dst */
+
+ if (fz_is_empty_irect(fz_intersect_irect(&bbox, fz_pixmap_bbox_no_ctx(dst, &bbox2))))
+ return;
+
x = bbox.x0;
y = bbox.y0;
w = bbox.x1 - bbox.x0;