mirror of
https://github.com/golang/go
synced 2024-11-20 03:04:40 -07:00
image/png: update palette out-of-bounds comment.
R=r CC=golang-dev https://golang.org/cl/6817070
This commit is contained in:
parent
002103f51c
commit
d659633aff
@ -198,10 +198,11 @@ func (d *decoder) parsePLTE(length uint32) error {
|
|||||||
d.palette[i] = color.RGBA{d.tmp[3*i+0], d.tmp[3*i+1], d.tmp[3*i+2], 0xff}
|
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++ {
|
for i := np; i < 256; i++ {
|
||||||
// Initialize the rest of the palette to opaque black. The spec isn't
|
// Initialize the rest of the palette to opaque black. The spec (section
|
||||||
// clear whether palette index values outside of those defined by the PLTE
|
// 11.2.3) says that "any out-of-range pixel value found in the image data
|
||||||
// chunk is an error: libpng 1.5.13 falls back to opaque black, the
|
// is an error", but some real-world PNG files have out-of-range pixel
|
||||||
// same as we do here, ImageMagick 6.5.7 returns an error.
|
// 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[i] = color.RGBA{0x00, 0x00, 0x00, 0xff}
|
||||||
}
|
}
|
||||||
d.palette = d.palette[:np]
|
d.palette = d.palette[:np]
|
||||||
|
Loading…
Reference in New Issue
Block a user