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 765705 - valid GIF images rejected by gdk-pixbuf
valid GIF images rejected by gdk-pixbuf
Status: RESOLVED OBSOLETE
Product: gdk-pixbuf
Classification: Platform
Component: loaders
git master
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on: 739202
Blocks:
 
 
Reported: 2016-04-28 05:38 UTC by Nigel Tao
Modified: 2018-05-22 13:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Tarball of three .gif images that eog (incorrectly) rejects (200.03 KB, application/x-bzip)
2016-04-28 05:38 UTC, Nigel Tao
  Details
tests: Add tests for bug 765705 (258.44 KB, patch)
2016-12-28 17:17 UTC, Bastien Nocera
none Details | Review

Description Nigel Tao 2016-04-28 05:38:53 UTC
Created attachment 326914 [details]
Tarball of three .gif images that eog (incorrectly) rejects

The Go program below generates two .gif files (attached as a tar.bz2). Both of these files are viewable with Firefox, Google Chrome and ImageMagick just fine, but not in Eye-of-Gnome, which AFAICT uses gdk-pixbuf.

The "GIF-image-loader-cannot-understand-this-image.gif" file triggers the code path at https://github.com/GNOME/gdk-pixbuf/blob/master/gdk-pixbuf/io-gif.c#L634 for which the comment immediately above says that: "FIXME - we should handle this case".

The "internal-error-in-the-GIF-loader.gif" file triggers the code path at https://github.com/GNOME/gdk-pixbuf/blob/master/gdk-pixbuf/io-gif.c#L500 and while I am not overly familiar with the gdk-pixbuf code, at the very least, untrusted image input should not trigger "internal errors", in my opinion.

A larger GIF image, lissajous.gif, is also in the tarball. It is the output of this Go program: https://github.com/adonovan/gopl.io/blob/master/ch1/lissajous/main.go

Once again, Firefox, Google Chrome and ImageMagick are all happy with this lissajous.gif file; Eye-of-Gnome is not, saying "Circular table entry in GIF file".

----
package main

import (
	"image"
	"image/color"
	"image/gif"
	"log"
	"os"
)

var palette = make([]color.Color, 256)

func main() {
	for i := range palette {
		palette[i] = color.Gray{byte(i)}
	}

	do(4, "GIF-image-loader-cannot-understand-this-image.gif")
	do(16, "internal-error-in-the-GIF-loader.gif")
}

func do(n int, filename string) {
	out, err := os.Create(filename)
	if err != nil {
		log.Fatal(err)
	}
	defer out.Close()

	// img is an n x n paletted image where every pixel is initialized to the
	// 0th entry in the palette.
	img := image.NewPaletted(image.Rect(0, 0, n, n), palette)

	// Change false to true in order to make each pixel have a distinct palette
	// index, so that the LZW compression step doesn't compress anything.
	//
	// Either way, this program should generate valid images, but when this is
	// false, it seems that eog cannot read the resultant GIF images, even
	// though Firefox, Google Chrome and ImageMagick can.
	if false {
		for i := range img.Pix {
			img.Pix[i] = byte(i)
		}
	}

	if err := gif.Encode(out, img, nil); err != nil {
		log.Fatal(err)
	}
}
----
Comment 1 Matthias Clasen 2016-08-02 17:53:27 UTC
The mere fact that a web browser doesn't crash on a file is not really sufficient to declare it spec-conformant, of course. But patches would be welcome.
Comment 2 Bastien Nocera 2016-12-28 17:17:18 UTC
Created attachment 342547 [details] [review]
tests: Add tests for bug 765705
Comment 3 GNOME Infrastructure Team 2018-05-22 13:19:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/55.