# HG changeset patch # User Chong Yidong # Date 1179014151 0 # Node ID cb616238ccb25818031c50e04b2d097a7c8a3dae # Parent e433e5f4e8ed3567e08077dd87e982bad11e2084 (pbm_load): Correctly check image size for greyscale pbm. diff -r e433e5f4e8ed -r cb616238ccb2 src/image.c --- a/src/image.c Sat May 12 23:55:42 2007 +0000 +++ b/src/image.c Sat May 12 23:55:51 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;