After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 620911 - gdk_pixbuf_save() PNG when compression option not last in list
gdk_pixbuf_save() PNG when compression option not last in list
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-07 22:17 UTC by Kevin Ryde
Modified: 2011-12-16 21:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
failing program (378 bytes, text/plain)
2010-06-07 22:17 UTC, Kevin Ryde
  Details
Fix handling of options when saving pngs (3.65 KB, patch)
2011-12-16 21:42 UTC, Matthias Clasen
committed Details | Review

Description Kevin Ryde 2010-06-07 22:17:21 UTC
Created attachment 162983 [details]
failing program

If the png format "compression" option to gdk_pixbuf_save() is not last in the options list then an incorrect tEXt property is written to the file.

The attached foo.c creates a foo.png which has a tEXt property "ssion" with value "9", where I hoped it would be property "Title" with value "blah".  The latter is what you get if the compression option is last in the options list instead of first.
Comment 1 Matthias Clasen 2011-12-16 21:41:39 UTC
Thanks for the test program !
Comment 2 Matthias Clasen 2011-12-16 21:42:02 UTC
The following fix has been pushed:
23cdf12 Fix handling of options when saving pngs
Comment 3 Matthias Clasen 2011-12-16 21:42:04 UTC
Created attachment 203702 [details] [review]
Fix handling of options when saving pngs

The png loader treats its options in two passes, the first pass
counts and verifies them, the second pass converts text options.
This worked ok when only text was understood, but with the introduction
of compression and icc-profile as supported options, the two loops
can now get out of sync when the text options are not all at the
beginning.

Fix this by skipping non-text options in the second loop, just
as we do in the first loop.