changeset 77692:f6cc3f58ce04

(pbm_load): Correctly check image size for greyscale pbm.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 12 May 2007 23:53:57 +0000
parents bf3050d47905
children 53803ddaa8b6
files src/image.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat May 12 23:53:49 2007 +0000
+++ b/src/image.c	Sat May 12 23:53:57 2007 +0000
@@ -5742,9 +5742,13 @@
     }
   else
     {
-      if (raw_p && (p + 3 * height * width > end))
+      if (raw_p
+	  && ((type == PBM_GRAY)
+	      ? (p + height * width > end)
+	      : (p + 3 * height * width > end)))
 	{
 	  x_destroy_x_image (ximg);
+	  x_clear_image (f, img);
 	  image_error ("Invalid image size in image `%s'",
 		       img->spec, Qnil);
 	  goto error;