Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image/png: invalid format: chunk out of order #54142

Open
kmicki opened this issue Jul 30, 2022 · 1 comment
Open

image/png: invalid format: chunk out of order #54142

kmicki opened this issue Jul 30, 2022 · 1 comment
Labels
NeedsInvestigation
Milestone

Comments

@kmicki
Copy link

@kmicki kmicki commented Jul 30, 2022

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

$ go version
go version go1.17.6 linux/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="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/deck/.cache/go-build"
GOENV="/home/deck/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/deck/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/deck/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3730379239=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Try to decode e.g. this file with png.Decode().

What did you expect to see?

No error and decoded image.

What did you see instead?

invalid format: chunk out of order

What I think is the cause

It looks like the problem is here.

This code expects that PLTE chunk is present only for Color type = 3 (Paletted). If it is present for other types, the mentioned error is thrown.

According to PNG specification, PLTE chunk may appear also for types 2 or 6. The PNG file linked above is type 2 and contains PLTE chunk, so it is compliant with PNG specs.

@seankhliao seankhliao added the NeedsInvestigation label Jul 30, 2022
@seankhliao
Copy link
Member

@seankhliao seankhliao commented Jul 30, 2022

cc @nigeltao

@dmitshur dmitshur added this to the Backlog milestone Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

3 participants