Control: tag -1 patch confirmed

Here is the backported patch (attached). I have no clue on how to use
dpatch to convert it. 20.jp2 does not segfault anymore, and p0_06.j2k
does decode normally.
--- libopenjpeg/tcd.c	2014-04-05 14:49:32.000000000 +0200
+++ ../../openjpeg-1.3+dfsg/libopenjpeg/tcd.c	2014-04-05 14:40:25.000000000 +0200
@@ -1415,6 +1415,17 @@
 
 	if (tcd->tcp->mct) {
 		int n = (tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0);
+
+#if 1
+      /* testcase 1336.pdf.asan.47.376 */
+      if ((tile->comps[0].x1 - tile->comps[0].x0) * (tile->comps[0].y1 - tile->comps[0].y0) < n ||
+        (  tile->comps[1].x1 - tile->comps[1].x0) * (tile->comps[1].y1 - tile->comps[1].y0) < n ||
+        (  tile->comps[2].x1 - tile->comps[2].x0) * (tile->comps[2].y1 - tile->comps[2].y0) < n) {
+        opj_event_msg(tcd->cinfo, EVT_ERROR, "Tiles don't all have the same dimension. Skip the MCT step.\n");
+        return false;
+      }
+#endif
+
 		if (tcd->tcp->tccps[0].qmfbid == 1) {
 			mct_decode(
 					tile->comps[0].data,

Reply via email to