*** empty log message ***
[bpt/emacs.git] / src / image.c
index e67096b..b8317b1 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions for image support on window system.
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-                 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+                 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -5742,6 +5742,14 @@ pbm_load (f, img)
     }
   else
     {
+      if (raw_p && (p + 3 * height * width > end))
+       {
+         x_destroy_x_image (ximg);
+         image_error ("Invalid image size in image `%s'",
+                      img->spec, Qnil);
+         goto error;
+       }
+
       for (y = 0; y < height; ++y)
        for (x = 0; x < width; ++x)
          {