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

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