Blame SOURCES/jasper-2.0.14-CVE-2021-26927.patch

491fbb
diff -urNp a/src/libjasper/jp2/jp2_dec.c b/src/libjasper/jp2/jp2_dec.c
491fbb
--- a/src/libjasper/jp2/jp2_dec.c	2021-06-01 13:32:59.330396797 +0200
491fbb
+++ b/src/libjasper/jp2/jp2_dec.c	2021-06-01 13:46:16.982925961 +0200
491fbb
@@ -230,7 +230,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
491fbb
 	  the value specified in the code stream? */
491fbb
 	if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,
491fbb
 	  jas_image_numcmpts(dec->image))) {
491fbb
-		jas_eprintf("warning: number of components mismatch\n");
491fbb
+		jas_eprintf("error: number of components mismatch (IHDR)\n");
491fbb
+        goto error;
491fbb
 	}
491fbb
 
491fbb
 	/* At least one component must be present. */
491fbb
@@ -253,7 +254,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
491fbb
 	  with the data in the code stream? */
491fbb
 	if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
491fbb
 	  (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
491fbb
-		jas_eprintf("warning: component data type mismatch\n");
491fbb
+		jas_eprintf("error: component data type mismatch (IHDR)\n");
491fbb
+        goto error;
491fbb
 	}
491fbb
 
491fbb
 	/* Is the compression type supported? */
491fbb
@@ -265,9 +267,10 @@ jas_image_t *jp2_decode(jas_stream_t *in
491fbb
 	if (dec->bpcc) {
491fbb
 		/* Is the number of components indicated in the BPCC box
491fbb
 		  consistent with the code stream data? */
491fbb
-		if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts(
491fbb
-		  dec->image))) {
491fbb
-			jas_eprintf("warning: number of components mismatch\n");
491fbb
+		if (dec->bpcc->data.bpcc.numcmpts !=
491fbb
+          JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) {
491fbb
+			    jas_eprintf("error: number of components mismatch (BPCC)\n");
491fbb
+                goto error;
491fbb
 		}
491fbb
 		/* Is the component data type information indicated in the BPCC
491fbb
 		  box consistent with the code stream data? */
491fbb
@@ -276,7 +279,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
491fbb
 			  ++i) {
491fbb
 				if (jas_image_cmptdtype(dec->image, i) !=
491fbb
 				  JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
491fbb
-					jas_eprintf("warning: component data type mismatch\n");
491fbb
+					    jas_eprintf("error: component data type mismatch (BPCC)\n");
491fbb
+                        goto error;
491fbb
 				}
491fbb
 			}
491fbb
 		} else {