# HG changeset patch # User Chong Yidong # Date 1179014037 0 # Node ID f6cc3f58ce04d3b207114391e3a2559ad08314b6 # Parent bf3050d4790568dca632e6f4fc804ba0d6cc4c33 (pbm_load): Correctly check image size for greyscale pbm. diff -r bf3050d47905 -r f6cc3f58ce04 src/image.c --- 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;