# HG changeset patch # User Chong Yidong # Date 1179154395 0 # Node ID 4e046b2396efa9afd4f2753e7bf391d383535423 # Parent 99c147d98917c97a774e984bcb1d1633d628ef45 (pbm_load): Check image size for monochrome pbm. diff -r 99c147d98917 -r 4e046b2396ef src/image.c --- 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; }