]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Import patch from sumatrapdf team. This handle testcase 4035.pdf.SIGSEGV...
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Wed, 26 Feb 2014 11:08:25 +0000 (11:08 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Wed, 26 Feb 2014 11:08:25 +0000 (11:08 +0000)
Update issue 225

src/lib/openjp2/j2k.c

index d6b7d6a69d02957731d802b40c86f6a024b14fc9..52cf06c5959e070fdccbee26b9a65ce30f8edf67 100644 (file)
@@ -1954,6 +1954,12 @@ static OPJ_BOOL opj_j2k_read_siz(opj_j2k_t *p_j2k,
                 return OPJ_FALSE;
         }
 
+        /* testcase 4035.pdf.SIGSEGV.d8b.3375 */
+        if (l_image->x0 > l_image->x1 || l_image->y0 > l_image->y1) {
+                opj_event_msg(p_manager, EVT_ERROR, "Error with SIZ marker: negative image size (%d x %d)\n", l_image->x1 - l_image->x0, l_image->y1 - l_image->y0);
+                return OPJ_FALSE;
+        }
+
 #ifdef USE_JPWL
         if (l_cp->correct) {
                 /* if JPWL is on, we check whether TX errors have damaged