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 785171 - Restore grayscale jpeg support after fix for bug 784866
Restore grayscale jpeg support after fix for bug 784866
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: loaders
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
: 785155 785504 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-07-20 13:06 UTC by my+gnomebugs
Modified: 2017-08-07 21:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
jpeg: restore grayscale image support (1.06 KB, patch)
2017-07-20 13:14 UTC, my+gnomebugs
none Details | Review
jpeg: Restore grayscale image support (1.06 KB, patch)
2017-07-27 11:06 UTC, Bastien Nocera
committed Details | Review
tests: Add grayscale JPEG tests (393.15 KB, patch)
2017-07-27 11:06 UTC, Bastien Nocera
committed Details | Review

Description my+gnomebugs 2017-07-20 13:06:26 UTC
After commit c2a40a92fe3df4111ed9da51fe3368c079b86926 (jpeg: Throw error when number of color components is unsupported), gdk-pixbuf will only load jpeg files with 3 or 4 color components. That precents the loading of grayscale images which have only one color component.

The commit message mentions that 1 color component images are unsupported, but there is a specific function called explode_gray_into_buf to handle JCS_GRAYSCALE, and my test images were displayed correctly without that change.
As far as I understand the code, 1 component JCS_GRAYSCALE images are safe to use and do not cause invalid writes.
Comment 1 my+gnomebugs 2017-07-20 13:14:05 UTC
Created attachment 356042 [details] [review]
jpeg: restore grayscale image support
Comment 2 Felix Riemann 2017-07-23 10:48:56 UTC
*** Bug 785155 has been marked as a duplicate of this bug. ***
Comment 3 Bastien Nocera 2017-07-27 11:06:12 UTC
Created attachment 356465 [details] [review]
jpeg: Restore grayscale image support

Commit c2a40a92fe3df4111ed9da51fe3368c079b86926 restricts the jpeg
loader to files with 3 or 4 color components.

Also allow JCS_GRAYSCALE images with only 1 color component.
These grayscale images are supported through explode_gray_into_buf.
Comment 4 Bastien Nocera 2017-07-27 11:06:19 UTC
Created attachment 356466 [details] [review]
tests: Add grayscale JPEG tests

Originally from the JPEG conformance tests:
http://people.sc.fsu.edu/~jburkardt/data/jpg/jpg.html
Comment 5 Bastien Nocera 2017-07-27 11:08:33 UTC
Fixed a few nits in the commit message and coding style, and added a test case.
Thanks!

Attachment 356465 [details] pushed as 6dd89e1 - jpeg: Restore grayscale image support
Attachment 356466 [details] pushed as 4a46294 - tests: Add grayscale JPEG tests
Comment 6 Bastien Nocera 2017-07-28 15:55:57 UTC
*** Bug 785504 has been marked as a duplicate of this bug. ***