FAQ
Reviewers: r,

Message:
Hello r@golang.org (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go


Description:
image/png: update palette out-of-bounds comment.

Please review this at http://codereview.appspot.com/6817070/

Affected files:
M src/pkg/image/png/reader.go


Index: src/pkg/image/png/reader.go
===================================================================
--- a/src/pkg/image/png/reader.go
+++ b/src/pkg/image/png/reader.go
@@ -198,10 +198,11 @@
d.palette[i] = color.RGBA{d.tmp[3*i+0], d.tmp[3*i+1], d.tmp[3*i+2],
0xff}
}
for i := np; i < 256; i++ {
- // Initialize the rest of the palette to opaque black. The spec isn't
- // clear whether palette index values outside of those defined by the
PLTE
- // chunk is an error: libpng 1.5.13 falls back to opaque black, the
- // same as we do here, ImageMagick 6.5.7 returns an error.
+ // Initialize the rest of the palette to opaque black. The spec (section
+ // 11.2.3) says that "any out-of-range pixel value found in the image
data
+ // is an error", but some real-world PNG files have out-of-range pixel
+ // values. We fall back to opaque black, the same as libpng 1.5.13;
+ // ImageMagick 6.5.7 returns an error.
d.palette[i] = color.RGBA{0x00, 0x00, 0x00, 0xff}
}
d.palette = d.palette[:np]

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 2, '12 at 2:25a
activeNov 2, '12 at 6:21a
posts3
users2
websitegolang.org

2 users in discussion

Nigeltao: 2 posts R: 1 post

People

Translate

site design / logo © 2022 Grokbase