WPG: Fix crash which image fails to produce expected PseudoClass indexes.
authorBob Friesenhahn <bfriesen@GraphicsMagick.org>
Sun, 10 Sep 2017 14:39:04 -0500
changeset 15161 3dc7b4e3779d
parent 15160 bb813c85f96a
child 15162 7ccf29bc782e
WPG: Fix crash which image fails to produce expected PseudoClass indexes.
ChangeLog
coders/wpg.c
www/Changelog.html
--- a/ChangeLog	Sun Sep 10 10:35:23 2017 -0500
+++ b/ChangeLog	Sun Sep 10 14:39:04 2017 -0500
@@ -1,5 +1,9 @@
 2017-09-10  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
+	* coders/wpg.c (InsertRow): Fix crash which occurs if image is not
+	PseudoClass but a PseudoColor scanline is needed.  Resolves
+	SourceForge issue #449 "Null pointer dereference in InsertRow()".
+
 	* coders/rle.c (ReadRLEImage): Impose image dimension limits
 	according to Utah RLE specification. Cap number of planes handled
 	internally at 4.  Remove non-standard multi-frame extension, which
--- a/coders/wpg.c	Sun Sep 10 10:35:23 2017 -0500
+++ b/coders/wpg.c	Sun Sep 10 14:39:04 2017 -0500
@@ -280,6 +280,9 @@
     case 2:  /* Convert PseudoColor scanline. */
       {
         indexes=AccessMutableIndexes(image);
+        if ((image->storage_class != PseudoClass) ||
+            (indexes == (IndexPacket *) NULL))
+          return MagickFail;
         x = 0;
         while(x < (long)image->columns-3)
           {
--- a/www/Changelog.html	Sun Sep 10 10:35:23 2017 -0500
+++ b/www/Changelog.html	Sun Sep 10 14:39:04 2017 -0500
@@ -38,6 +38,9 @@
 <p>2017-09-10  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li>coders/wpg.c (InsertRow): Fix crash which occurs if image is not
+PseudoClass but a PseudoColor scanline is needed.  Resolves
+SourceForge issue #449 &quot;Null pointer dereference in InsertRow()&quot;.</li>
 <li>coders/rle.c (ReadRLEImage): Impose image dimension limits
 according to Utah RLE specification. Cap number of planes handled
 internally at 4.  Remove non-standard multi-frame extension, which