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

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Aug 4 11:28:19 PDT 2006


Author: alexcher
Date: 2006-08-04 11:28:19 -0700 (Fri, 04 Aug 2006)
New Revision: 6965

Modified:
   trunk/gs/src/zstack.c
Log:
Makes roll operator generate stackunderflow rather than rangecheck when 
there's not enough elements on the stack.



Modified: trunk/gs/src/zstack.c
===================================================================
--- trunk/gs/src/zstack.c	2006-08-04 18:11:09 UTC (rev 6964)
+++ trunk/gs/src/zstack.c	2006-08-04 18:28:19 UTC (rev 6965)
@@ -112,7 +112,7 @@
 
     check_type(*op1, t_integer);
     check_type(*op, t_integer);
-    if ((ulong) op1->value.intval > op1 - osbot) {
+    if ((ulong) op1->value.intval > (ulong)(op1 - osbot)) {
 	/*
 	 * The data might span multiple stack blocks.
 	 * There are efficient ways to handle this situation,
@@ -121,10 +121,10 @@
 	 */
 	int left, i;
 
-	if (op1->value.intval < 0 ||
-	    op1->value.intval + 2 > ref_stack_count(&o_stack)
-	    )
+	if (op1->value.intval < 0) 
 	    return_error(e_rangecheck);
+	if (op1->value.intval + 2 > (int)ref_stack_count(&o_stack))
+	    return_error(e_stackunderflow);
 	count = op1->value.intval;
 	if (count <= 1) {
 	    pop(2);



More information about the gs-cvs mailing list