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

alexcher at ghostscript.com alexcher at ghostscript.com
Fri Aug 4 10:29:08 PDT 2006


Author: alexcher
Date: 2006-08-04 10:29:08 -0700 (Fri, 04 Aug 2006)
New Revision: 6963

Modified:
   trunk/gs/src/zgeneric.c
Log:
Makes copy operator generate rangecheck rather than stackunderflow when given
a negative argument.


Modified: trunk/gs/src/zgeneric.c
===================================================================
--- trunk/gs/src/zgeneric.c	2006-08-04 16:55:18 UTC (rev 6962)
+++ trunk/gs/src/zgeneric.c	2006-08-04 17:29:08 UTC (rev 6963)
@@ -74,8 +74,10 @@
     if ((ulong) op->value.intval > (ulong)(op - osbot)) {
 	/* There might be enough elements in other blocks. */
 	check_type(*op, t_integer);
-        if ((ulong)op->value.intval >= ref_stack_count(&o_stack)) 
+        if (op->value.intval >= (int)ref_stack_count(&o_stack)) 
             return_error(e_stackunderflow);
+        if (op->value.intval < 0) 
+            return_error(e_rangecheck);
         check_int_ltu(*op, ref_stack_count(&o_stack));
 	count = op->value.intval;
     } else if (op1 + (count = op->value.intval) <= ostop) {



More information about the gs-cvs mailing list