[gs-cvs] gs/src

Ray Johnston ray at ghostscript.com
Wed Apr 13 13:04:48 PDT 2005


Update of /cvs/ghostscript/gs/src
In directory casper2:/tmp/cvs-serv10557/src

Modified Files:
	gximage4.c 
Log Message:
Fix a SEGV when ImageType 4 has MaskColor values outside the range.
Detected with the PDF file from bug 687611 for customer 870.

DETAILS:

The rangecheck error was being thrown with the gx_image_enum allocated
but with many pointers not initialized so the SEGV happened when the
garbage collector tried to enumerate the image_enum.

The fix is simple and low-risk -- free the penum before returning the
rangecheck error.


Index: gximage4.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gximage4.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gximage4.c	21 Feb 2002 22:24:53 -0000	1.5
+++ gximage4.c	13 Apr 2005 20:04:46 -0000	1.6
@@ -90,8 +90,10 @@
 	    else
 		c0 = c1 = pim->MaskColor[i >> 1];
 
-	    if ((c0 | c1) > max_value)
+	    if ((c0 | c1) > max_value) {
+		gs_free_object(mem, penum, "gx_begin_image4");
 		return_error(gs_error_rangecheck);
+	    }
 	    if (c0 > c1) {
 		opaque = true;	/* pixel can never match mask color */
 		break;



More information about the gs-cvs mailing list