Skip to content

image/gif: panics for several GIFs #5401

@CSEMike

Description

@CSEMike
I've observed several panics in image/draw when working with real-world GIFs that work
with other libraries (e.g., they display in Chrome.)

Attached are two representative images that induce different failures and a program to
repro.

I've tested with two versions:
Version:  devel +62bf913b4f40 Wed Feb 27 20:55:01 2013 -0800
Version:  devel +1d079908dd84 Thu Apr 25 18:47:12 2013 +0200

Stack traces are below. Please let me know if there's anything else you need. Thanks!

From 62bf913b4f40 --

For crash1.gif --
$ go run imagecrash.go crash1.gif 
Version:  devel +62bf913b4f40 Wed Feb 27 20:55:01 2013 -0800
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x44786f]

goroutine 1 [running]:
image/draw.drawRGBA(0x4c20006f0c0, 0x0, 0x0, 0x1, 0x1, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:473 +0x42f
image/draw.DrawMask(0x4c20006f100, 0x4c20006f0c0, 0x0, 0x0, 0x1, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:114 +0x35d
image/draw.Draw(0x4c20006f100, 0x4c20006f0c0, 0x0, 0x0, 0x1, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:37 +0xbb
main.main()
    /usr/local/google/home/piatek/speed/piatek-pss-git2/google3/experimental/users/piatek/imagecrash.go:30 +0x447
exit status 2

For crash2.gif --
$ go run imagecrash.go crash2.gif 
Version:  devel +62bf913b4f40 Wed Feb 27 20:55:01 2013 -0800
panic: runtime error: index out of range

goroutine 1 [running]:
image.(*Paletted).At(0x4c2000700c0, 0x0, 0x23, 0x4c200059480, 0xfffbfbfb, ...)
    /usr/lib/google-golang/src/pkg/image/image.go:822 +0x15e
image/draw.drawRGBA(0x4c20006f0c0, 0x0, 0x0, 0x12c, 0x24, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:473 +0x421
image/draw.DrawMask(0x4c20006f100, 0x4c20006f0c0, 0x0, 0x0, 0x12c, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:114 +0x35d
image/draw.Draw(0x4c20006f100, 0x4c20006f0c0, 0x0, 0x0, 0x12c, ...)
    /usr/lib/google-golang/src/pkg/image/draw/draw.go:37 +0xbb
main.main()
    /usr/local/google/home/piatek/speed/piatek-pss-git2/google3/experimental/users/piatek/imagecrash.go:30 +0x447
exit status 2

Attachments:

  1. imagecrash.go (498 bytes)
  2. crash1.gif (29 bytes)
  3. crash2.gif (2533 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions