From 76edbbafe01574ee2d6539f9b87e30a3f33ccd51 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 6 May 2016 19:11:52 -0400 Subject: [PATCH] The number of colors is limited to 65535 --- coders/xpm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/coders/xpm.c b/coders/xpm.c index 6de6c0b34..7d9021c37 100644 --- a/coders/xpm.c +++ b/coders/xpm.c @@ -336,9 +336,13 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception) if (count == 4) break; } - if ((count != 4) || (width == 0) || (width > 10) || (image->columns == 0) || - (image->rows == 0) || (image->colors == 0)) - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + if ((count != 4) || (width == 0) || (width > 2) || + (image->columns == 0) || (image->rows == 0) || + (image->colors == 0) || (image->colors > MaxColormapSize)) + { + xpm_buffer=DestroyString(xpm_buffer); + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + } /* Remove unquoted characters. */ -- 2.40.0