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

ray at ghostscript.com ray at ghostscript.com
Mon Jul 16 10:25:31 PDT 2007


Author: ray
Date: 2007-07-16 10:25:30 -0700 (Mon, 16 Jul 2007)
New Revision: 8130

Modified:
   trunk/gs/src/gdevmem.c
Log:
Fix a divide by zero that would show up on linux, but not cygwin.
Seen with 001-01.ps to the x11 device.


Modified: trunk/gs/src/gdevmem.c
===================================================================
--- trunk/gs/src/gdevmem.c	2007-07-16 17:06:58 UTC (rev 8129)
+++ trunk/gs/src/gdevmem.c	2007-07-16 17:25:30 UTC (rev 8130)
@@ -227,8 +227,9 @@
 	planes = &plane1, plane1.depth = dev->color_info.depth, num_planes = 1;
     for (size = 0, pi = 0; pi < num_planes; ++pi)
 	size += bitmap_raster(width * planes[pi].depth);
-    if (size > (max_ulong - ARCH_ALIGN_PTR_MOD) / (ulong)height)
-	return_error(gs_error_VMerror);
+    if (height != 0)
+	if (size > (max_ulong - ARCH_ALIGN_PTR_MOD) / (ulong)height)
+	    return_error(gs_error_VMerror);
     *psize = ROUND_UP(size * height, ARCH_ALIGN_PTR_MOD);
     return 0;
 }



More information about the gs-cvs mailing list