ref: a43f448139d0a72688c9191adab0718b9ef43ec5
parent: 33e85ea71051ad64ca4bb8b874dcf8bed9b66e62
author: Shailesh Mistry <shailesh.mistry@hotmail.co.uk>
date: Wed Feb 8 18:13:13 EST 2012
Bug 690870: This patch prevents the image compositing occurring if the src is outside of the clip region.
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -198,7 +198,7 @@
w = src->width;
h = src->height;
ss = src->data;
- /* FIXME: this isn't sufficient for the < 0 cases */
+
if (x < 0) { w += x; x = 0; }
if (y < 0) { h += y; y = 0; }
w = (x + w < dst->width) ? w : dst->width - x;
@@ -208,6 +208,15 @@
"compositing %dx%d at (%d, %d) after clipping\n",
w, h, x, y);
#endif
+
+ /* check for zero clipping region */
+ if ((w <= 0) || (h <= 0))
+ {
+#ifdef JBIG2_DEBUG
+ jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "zero clipping region");
+#endif
+ return 0;
+ }
#if 0
/* special case complete/strip replacement */