File jasper-CVE-2021-26926-CVE-2021-26927.patch of Package jasper.32091

Index: jasper-1.900.14/src/libjasper/jp2/jp2_dec.c
===================================================================
--- jasper-1.900.14.orig/src/libjasper/jp2/jp2_dec.c
+++ jasper-1.900.14/src/libjasper/jp2/jp2_dec.c
@@ -227,7 +227,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
 	  the value specified in the code stream? */
 	if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(uint,
 	  jas_image_numcmpts(dec->image))) {
-		jas_eprintf("warning: number of components mismatch\n");
+		jas_eprintf("error: number of components mismatch (IHDR)\n");
+		goto error;
 	}
 
 	/* At least one component must be present. */
@@ -250,7 +251,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
 	  with the data in the code stream? */
 	if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
 	  (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
-		jas_eprintf("warning: component data type mismatch (IHDR)\n");
+		jas_eprintf("error: component data type mismatch (IHDR)\n");
+		goto error;
 	}
 
 	/* Is the compression type supported? */
@@ -262,9 +264,10 @@ jas_image_t *jp2_decode(jas_stream_t *in
 	if (dec->bpcc) {
 		/* Is the number of components indicated in the BPCC box
 		  consistent with the code stream data? */
-		if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(uint, jas_image_numcmpts(
-		  dec->image))) {
-			jas_eprintf("warning: number of components mismatch\n");
+		if (dec->bpcc->data.bpcc.numcmpts !=
+				JAS_CAST(jas_uint, jas_image_numcmpts(dec->image))) {
+			jas_eprintf("error: number of components mismatch (BPCC)\n");
+			goto error;
 		}
 		/* Is the component data type information indicated in the BPCC
 		  box consistent with the code stream data? */
@@ -273,7 +276,8 @@ jas_image_t *jp2_decode(jas_stream_t *in
 			  ++i) {
 				if (jas_image_cmptdtype(dec->image, i) !=
 				  JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
-					jas_eprintf("warning: component data type mismatch (BPCC)\n");
+					jas_eprintf("error: component data type mismatch (BPCC)\n");
+					goto error;
 				}
 			}
 		} else {
Index: jasper-1.900.14/src/libjasper/include/jasper/jas_types.h
===================================================================
--- jasper-1.900.14.orig/src/libjasper/include/jasper/jas_types.h
+++ jasper-1.900.14/src/libjasper/include/jasper/jas_types.h
@@ -122,6 +122,9 @@
 #define ulonglong unsigned long long
 #endif
 
+#define jas_uint unsigned int
+
+
 /* The below macro is intended to be used for type casts.  By using this
   macro, type casts can be easily located in the source code with
   tools like "grep". */
openSUSE Build Service is sponsored by