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 768484 - Set errors on broken ico headers to avoid asserts / warnings
Set errors on broken ico headers to avoid asserts / warnings
Product: gdk-pixbuf
Classification: Platform
Component: loaders
git master
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
Depends on:
Reported: 2016-07-06 13:05 UTC by Hanno Böck
Modified: 2016-08-03 16:51 UTC
See Also:
GNOME target: ---
GNOME version: ---

patch to set correct error in io-ico.c (1.20 KB, patch)
2016-07-06 13:05 UTC, Hanno Böck
committed Details | Review
example file (6 bytes, application/octet-stream)
2016-07-06 13:06 UTC, Hanno Böck

Description Hanno Böck 2016-07-06 13:05:23 UTC
Created attachment 330946 [details] [review]
patch to set correct error in io-ico.c

The attached patch will set correct errors in certain situations when a broken ico header is detected in io-ico.c.

On a malformed file that gets detected as an ico the missing error will either cause a warning like this:
(process:15365): GdkPixbuf-WARNING **: Bug! gdk-pixbuf loader 'ico' didn't set an error on failure.

Or even an assert if compiled with it:
GdkPixbuf:ERROR:gdk-pixbuf-animation.c:247:gdk_pixbuf_animation_new_from_file: assertion failed: (animation)

I'll also attach a minimal file triggering the bug.

(This bug was discovered with the help of american fuzzy lop)
Comment 1 Hanno Böck 2016-07-06 13:06:05 UTC
Created attachment 330947 [details]
example file
Comment 2 Matthias Clasen 2016-08-02 17:18:31 UTC
It would be great if you could attach git-formatted patches with commit messages.
Thanks for the fix anyway!
Comment 3 Matthias Clasen 2016-08-03 16:51:54 UTC
I actually ended up reverting this change in the commit, since it turned out to be broken. DecodeHeader is supposed to return without setting an error in these cases, since we may be loading incrementally, and need to wait for more data.