GNOME Bugzilla – Bug 765705
valid GIF images rejected by gdk-pixbuf
Last modified: 2018-05-22 13:19:46 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) } } ----
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.
Created attachment 342547 [details] [review] tests: Add tests for bug 765705
-- 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.