[gs-cvs] rev 7044 - trunk/gs/jasper/src/libjasper/jp2

giles at ghostscript.com giles at ghostscript.com
Wed Sep 13 19:07:09 PDT 2006


Author: giles
Date: 2006-09-13 19:07:08 -0700 (Wed, 13 Sep 2006)
New Revision: 7044

Modified:
   trunk/gs/jasper/src/libjasper/jp2/jp2_dec.c
Log:
Check for a jpx image decoding fewer than the expected number of 
channels, returning an error instead of a segfault. Work around
for bug 688869, customer 531.


Modified: trunk/gs/jasper/src/libjasper/jp2/jp2_dec.c
===================================================================
--- trunk/gs/jasper/src/libjasper/jp2/jp2_dec.c	2006-09-14 01:57:35 UTC (rev 7043)
+++ trunk/gs/jasper/src/libjasper/jp2/jp2_dec.c	2006-09-14 02:07:08 UTC (rev 7044)
@@ -383,6 +383,13 @@
 	}
 
 	/* Determine the type of each component. */
+	/* work around for gs bug 688869 - RG */
+	if (dec->numchans >= dec->image->numcmpts_) {
+		jas_eprintf("error: too few components in decoded image!"
+			" (%d instead of %d)\n",
+			dec->image->numcmpts_, dec->numchans);
+		goto error;
+	}
 	if (dec->cdef) {
 		for (i = 0; i < dec->numchans; ++i) {
 			jas_image_setcmpttype(dec->image,



More information about the gs-cvs mailing list