Skip to content

image/gif: EncodeAll panics when a palette is too large to encode #20249

Closed
@topherbullock

Description

@topherbullock

What version of Go are you using (go version)?

1.8.1

What operating system and processor architecture are you using (go env)?

darwin / amd64

What did you do?

Created a gif image with a palette ( either global or local color table for a frame ) containing > 256 colors.

https://play.golang.org/p/xfDZCcSIFF

What did you expect to see?

The EncodeAll function returns errors when image blocks are too large, on a zero-length gif, etc. As such, in this case since we know the gif can't be encoded due to the palette length being > 256, I would expect a similar error, along the lines of errors.New("gif: image palette is too large to encode") to match the style here

What did you see instead?

It panics here trying to read log2Lookup[-1] defined here

I have a change-set ready with the proposed functionality and accompanying tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions