changeset 80916:4e046b2396ef

(pbm_load): Check image size for monochrome pbm.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 14 May 2007 14:53:15 +0000
parents 99c147d98917
children 898efffc00df
files src/image.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Mon May 14 14:53:09 2007 +0000
+++ b/src/image.c	Mon May 14 14:53:15 2007 +0000
@@ -5730,7 +5730,17 @@
 	    if (raw_p)
 	      {
 		if ((x & 7) == 0)
-		  c = *p++;
+		  {
+		    if (p >= end)
+		      {
+			x_destroy_x_image (ximg);
+			x_clear_image (f, img);
+			image_error ("Invalid image size in image `%s'",
+				     img->spec, Qnil);
+			goto error;
+		      }
+		    c = *p++;
+		  }
 		g = c & 0x80;
 		c <<= 1;
 	      }