We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1c9783 commit 63e129bCopy full SHA for 63e129b
src/image/png/reader.go
@@ -51,6 +51,10 @@ func cbPaletted(cb int) bool {
51
return cbP1 <= cb && cb <= cbP8
52
}
53
54
+func cbTrueColor(cb int) bool {
55
+ return cb == cbTC8 || cb == cbTC16
56
+}
57
+
58
// Filter type, as per the PNG spec.
59
const (
60
ftNone = 0
@@ -898,6 +902,10 @@ func (d *decoder) parseChunk(configOnly bool) error {
898
902
if d.stage != dsSeenPLTE {
899
903
return chunkOrderError
900
904
905
+ } else if cbTrueColor(d.cb) {
906
+ if d.stage != dsSeenIHDR && d.stage != dsSeenPLTE {
907
+ return chunkOrderError
908
+ }
901
909
} else if d.stage != dsSeenIHDR {
910
911
0 commit comments