[trunk] Really apply r2460 this time, but fix the original typo in the submitted...
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 28 Feb 2014 14:52:58 +0000 (14:52 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 28 Feb 2014 14:52:58 +0000 (14:52 +0000)
Update issue 225

src/lib/openjp2/j2k.c

index 924fdd600a0e1bc591e1667a1f23ba6091ca2088..bd39f759324f4983d5571156509f304330601f88 100644 (file)
@@ -4481,6 +4481,14 @@ static OPJ_BOOL opj_j2k_read_rgn (opj_j2k_t *p_j2k,
         };
 #endif /* USE_JPWL */
 
+        /* testcase 3635.pdf.asan.77.2930 */
+        if (l_comp_no >= l_nb_comp) {
+                opj_event_msg(p_manager, EVT_ERROR,
+                        "bad component number in RGN (%d when there are only %d)\n",
+                        l_comp_no, l_nb_comp);
+                return OPJ_FALSE;
+        }
+
         opj_read_bytes(p_header_data,(OPJ_UINT32 *) (&(l_tcp->tccps[l_comp_no].roishift)),1);   /* SPrgn */
         ++p_header_data;