GraphicsMagick: coders/xpm.c (ReadXPMImage): Output intelligent ...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.11511.1667242123.1350.graphicsmagick-commit@lists.sourceforge.net>
changeset bb7f2ca233e9 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=bb7f2ca233e9
summary: coders/xpm.c (ReadXPMImage): Output intelligent messag when colormap exceeds limit.

diffstat:

 ChangeLog    |  5 +++++
 coders/xpm.c |  6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 4f2c06830ec3 -r bb7f2ca233e9 ChangeLog
--- a/ChangeLog	Mon Oct 31 11:06:49 2022 -0500
+++ b/ChangeLog	Mon Oct 31 19:48:00 2022 +0100
@@ -1,3 +1,8 @@
+2022-10-31  Fojtik Jaroslav  <[email protected]>
+
+	* coders/xpm.c (ReadXPMImage): Output intelligent messag when colormap 
+        exceeds limit.
+
 2022-10-31  Bob Friesenhahn  <[email protected]>
 
 	* magick/blob.c (ReadBlobString): Fix oss-fuzz issue 52917
diff -r 4f2c06830ec3 -r bb7f2ca233e9 coders/xpm.c
--- a/coders/xpm.c	Mon Oct 31 11:06:49 2022 -0500
+++ b/coders/xpm.c	Mon Oct 31 19:48:00 2022 +0100
@@ -351,9 +351,11 @@
     }
   if ((count != 4) || (width == 0) || (width > 3) ||
       (image->columns == 0) || (image->rows == 0) ||
-      (image->colors == 0) || (image->colors > MaxColormapSize))
+      (image->colors == 0))
     ThrowXPMReaderException(CorruptImageError,ImproperImageHeader,image);
-  image->depth=16;
+  if(image->colors > MaxColormapSize)
+    ThrowXPMReaderException(CoderError,ColormapTooLarge,image);
+  image->depth=16;	/* TODO: Depth 16 is nonsense in many cases, please fix. */
 
   /*
     Remove unquoted characters.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.