[gs-cvs] rev 7029 - trunk/gs/src

alexcher at ghostscript.com alexcher at ghostscript.com
Sun Sep 10 08:55:10 PDT 2006


Author: alexcher
Date: 2006-09-10 08:55:10 -0700 (Sun, 10 Sep 2006)
New Revision: 7029

Modified:
   trunk/gs/src/sfxstdio.c
   trunk/gs/src/zcontrol.c
Log:
Pacify Valgrind. Initialize an uninitialized variable and break up an
expression, which, after overly aggressive optimization, causes an access
to uninitialized memory. Partial fix for the bug 688845.


Modified: trunk/gs/src/sfxstdio.c
===================================================================
--- trunk/gs/src/sfxstdio.c	2006-09-10 15:16:03 UTC (rev 7028)
+++ trunk/gs/src/sfxstdio.c	2006-09-10 15:55:10 UTC (rev 7029)
@@ -156,6 +156,7 @@
 	return 0;
     s_init_ids(s);
     s->is_temp = 0;		/* not a temp stream */
+    s->foreign = 0;
     /*
      * Disable the stream now (in case we can't open the file,
      * or a filter init procedure fails) so that `restore' won't

Modified: trunk/gs/src/zcontrol.c
===================================================================
--- trunk/gs/src/zcontrol.c	2006-09-10 15:16:03 UTC (rev 7028)
+++ trunk/gs/src/zcontrol.c	2006-09-10 15:55:10 UTC (rev 7029)
@@ -1009,12 +1009,13 @@
 	es_ptr ep = rsenum.ptr + used - 1;
 	uint count = used;
 
-	for (; count; count--, ep--)
-	    if (r_is_estack_mark(ep) &&
-		estack_mark_index(ep) == es_stopped &&
-		(ep[2].value.intval & mask) != 0
-		)
-		return scanned + (used - count + 1);
+	for (; count; count--, ep--) {
+	    if (r_is_estack_mark(ep)) {
+		if (estack_mark_index(ep) == es_stopped &&
+		  (ep[2].value.intval & mask) != 0)
+		    return scanned + (used - count + 1);
+	    }
+	}	
 	scanned += used;
     } while (ref_stack_enum_next(&rsenum));
     return 0;



More information about the gs-cvs mailing list