]> git.eshelyaron.com Git - emacs.git/commitdiff
(pbm_load): Correctly check image size for greyscale pbm.
authorChong Yidong <cyd@stupidchicken.com>
Sat, 12 May 2007 23:55:51 +0000 (23:55 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 12 May 2007 23:55:51 +0000 (23:55 +0000)
src/image.c

index b8317b1e9826b771405ed652e0faaa0f116852dc..eacea4a1d972dbd1db47a23b811056ca47e008d6 100644 (file)
@@ -5742,9 +5742,13 @@ pbm_load (f, img)
     }
   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;