Fix for 687232, getbitsrect with raster = 0 crashes

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Avoid a numeric exception; throw /rangecheck when .getbitsrect operator 
is invoked with raster width = 0.
Fix bug 687223.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
zdevice.c.diff (text/plain, 574 B)
Index: gs/src/zdevice.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zdevice.c,v
retrieving revision 1.7
diff -b -u -r1.7 zdevice.c
--- a/gs/src/zdevice.c	22 Aug 2002 07:12:29 -0000	1.7
+++ b/gs/src/zdevice.c	11 May 2004 21:34:30 -0000
@@ -165,6 +165,8 @@
 	depth = (dev->color_info.num_components +
 		 (options & GB_ALPHA_NONE ? 0 : 1)) * std_depth;
     }
+    if (w == 0)
+	return_error(e_rangecheck);
     raster = (w * depth + 7) >> 3;
     check_write_type(*op, t_string);
     num_rows = r_size(op) / raster;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.