Skip to content

image/gif: gif decoding fails on 1x1 pixel image that renders correctly in browser #56771

@ccampbell

Description

@ccampbell

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

go version go1.19.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ccampbell/Library/Caches/go-build"
GOENV="/Users/ccampbell/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ccampbell/go/pkg/mod"
GONOPROXY="github.com/fastly"
GONOSUMDB="github.com/fastly"
GOOS="darwin"
GOPATH="/Users/ccampbell/go"
GOPRIVATE="github.com/fastly"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.19.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.19.3/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ccampbell/Sites/gif-decode-error/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4b/zg1r6yhs61n89x8d8r02d9zh0000gn/T/go-build925926509=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Playground to reproduce is here:
https://go.dev/play/p/itdNnujIVfy

I included the image as a base64 data url in the playground so you can copy and paste that directly into the browser.

For convenience, I also uploaded it here:
https://test.craig.cloud/test-blank.gif

What did you expect to see?

Expected to see no decode error.

What did you see instead?

decode error: gif: too much image data

The image renders correctly in a browser. Seems perhaps related to #16146, but it is failing at a different point.

The specific failure occurs at

return errTooMuch

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions