-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.7.1 darwin/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/tmp/gopath:/Users/artyom/gopath"
GORACE=""
GOROOT="/Users/artyom/Library/go"
GOTOOLDIR="/Users/artyom/Library/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lb/3rk8rqs53czgb4v35w_342xc0000gn/T/go-build425021710=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
- Save linked original png file or its attached copy as
/tmp/bad.png. - Save and run https://play.golang.org/p/7KawpAoMqX
What did you expect to see?
Either no error message or png.UnsupportedError text.
What did you see instead?
png: invalid format: chunk out of order
Initially I thought that file was incorrect but that doesn't seem to be the case:
$ pngcheck -v -p /tmp/bad.png
File: /tmp/bad.png (3616 bytes)
chunk IHDR at offset 0x0000c, length 13
128 x 128 image, 24-bit RGB, non-interlaced
chunk tRNS at offset 0x00025, length 6
red = 0x00ff, green = 0x00ff, blue = 0x00ff
chunk IDAT at offset 0x00037, length 3541
zlib: deflated, 32K window, superfast compression
chunk IEND at offset 0x00e18, length 0
No errors detected in /tmp/bad.png (4 chunks, 92.6% compression).
It seems to have tRNS chunk but no PLTE chunk, as it's a truecolor transparent file, which is valid per spec. Ordering seem to be valid as well.
Applying the following patch:
diff --git i/src/image/png/reader.go w/src/image/png/reader.go
index 2dd5ed8..6159323 100644
--- i/src/image/png/reader.go
+++ w/src/image/png/reader.go
@@ -709,7 +709,7 @@ func (d *decoder) parseChunk() error {
d.stage = dsSeenPLTE
return d.parsePLTE(length)
case "tRNS":
- if d.stage != dsSeenPLTE {
+ if d.stage != dsSeenPLTE && d.stage != dsSeenIHDR {
return chunkOrderError
}
d.stage = dsSeentRNS
results in error reported as png: unsupported feature: truecolor transparency which seems to be the correct message for this case.
/cc @nigeltao
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.