Fwd: Bug in pngtrans.c, function png_permit_mng_features(). Suggested fix included.

Glenn Randers-Pehrson <[email protected]> Mon, 15 Jan 2018 15:02:02 -0500
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CA+PdXctsS6bVUF9oUOWbpwNm0a+cWF13U0AggYY-VUHo6gd+DQ@mail.gmail.com>
---------- Forwarded message ----------
From:  <[email protected]>
Date: Mon, Jan 15, 2018 at 11:31 AM
Subject: Bug in pngtrans.c, function png_permit_mng_features().
Suggested fix included.
To: [email protected]
Cc: [email protected]


REPLY at https://sourceforge.net/u/gregoryjwolfe/profile/send_message

________________________________

[Could not find how to submit a PNG ticket, so here goes.]

Using libpng-1.7.0beta89 with GraphicsMagick. PNG is causing a failure
of the GM regression tests. Function png_permit_mng_features()
attempts to add two transforms using the same 'order' value, which
later causes an affirm() failure in png_add_transform(). Suggested fix
(note lines with //***):

png_uint_32 PNGAPI
png_permit_mng_features(png_structrp png_ptr, png_uint_32 mng_features)
{
if (png_ptr != NULL)
{
if (png_ptr->read_struct) //
{ //

ifdef PNG_MNG_READ_FEATURES_SUPPORTED

     if ((mng_features &amp; PNG_FLAG_MNG_FILTER_64) != 0)
        png_add_transform(png_ptr, 0/*size*/, png_init_read_intrapixel,
           PNG_TR_MNG_INTRAPIXEL);

else / !MNG_READ_FEATURES /

        png_app_error(png_ptr, &#34;MNG not supported on read&#34;);
        return;

endif / !MNG_READ_FEATURES /

     } //***

     if (!png_ptr-&gt;read_struct) //***
     { //***

ifdef PNG_MNG_WRITE_FEATURES_SUPPORTED

     if ((mng_features &amp; PNG_FLAG_MNG_FILTER_64) != 0)
        png_add_transform(png_ptr, 0/*size*/, png_init_write_intrapixel,
           PNG_TR_MNG_INTRAPIXEL);

else / !MNG_WRITE_FEATURES /

        png_app_error(png_ptr, &#34;MNG not supported on write&#34;);
        return;

endif / !MNG_WRITE_FEATURES /

     } //***

  return png_ptr-&gt;mng_features_permitted =
     mng_features &amp; PNG_ALL_MNG_FEATURES;

}

return 0;
}

________________________________

This message was sent to you via the SourceForge web mail form.
Replying to this email will not work, please send a message to Gregory
J Wolfe at https://sourceforge.net/u/gregoryjwolfe/profile/send_message

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot