1
0
mirror of https://github.com/golang/go synced 2024-11-19 17:14:44 -07:00

image/jpeg: handle fill bytes.

Fixes #4337.

R=r, minux.ma
CC=golang-dev
https://golang.org/cl/6814098
This commit is contained in:
Nigel Tao 2012-11-08 10:36:29 +11:00
parent c208a3a263
commit 64b3e590c0

View File

@ -236,6 +236,14 @@ func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, error) {
return nil, FormatError("missing 0xff marker start")
}
marker := d.tmp[1]
for marker == 0xff {
// Section B.1.1.2 says, "Any marker may optionally be preceded by any
// number of fill bytes, which are bytes assigned code X'FF'".
marker, err = d.r.ReadByte()
if err != nil {
return nil, err
}
}
if marker == eoiMarker { // End Of Image.
break
}