From c295e710a2de066fd57c10bf800a90980b1b5704 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 14 May 2007 14:53:15 +0000 Subject: [PATCH] (pbm_load): Check image size for monochrome pbm. --- src/image.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/image.c b/src/image.c index eacea4a1d97..12b27fe359f 100644 --- a/src/image.c +++ b/src/image.c @@ -5730,7 +5730,17 @@ pbm_load (f, img) 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; } -- 2.39.5