shithub: jbig2

Download patch

ref: 002101876a97ca621b6d98839fa09f3c0a8ddee9
parent: 36a8a98780518f0cfe3f4afd9ea34b7b21ba2ac5
author: Robin Watts <robin.watts@artifex.com>
date: Tue Feb 28 12:36:00 EST 2017

Add sanity check on image sizes.

Inspired by bug 697395, but doesn't actually solve any problem
seen in that bug (or at least, not that I can see, as I can't
reproduce the problem with file2).

--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -38,6 +38,13 @@
     uint32_t stride;
     int64_t check;
 
+    if (width == 0 || height == 0) {
+        jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1,
+            "zero width (%d) or height (%d) in jbig2_image_new",
+            width, height);
+        return NULL;
+    }
+
     image = jbig2_new(ctx, Jbig2Image, 1);
     if (image == NULL) {
         jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not allocate image structure in jbig2_image_new");