Commit 64b3e590 authored by Nigel Tao's avatar Nigel Tao

image/jpeg: handle fill bytes.

Fixes #4337.

R=r, minux.ma
CC=golang-dev
https://golang.org/cl/6814098
parent c208a3a2
...@@ -236,6 +236,14 @@ func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, error) { ...@@ -236,6 +236,14 @@ func (d *decoder) decode(r io.Reader, configOnly bool) (image.Image, error) {
return nil, FormatError("missing 0xff marker start") return nil, FormatError("missing 0xff marker start")
} }
marker := d.tmp[1] 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. if marker == eoiMarker { // End Of Image.
break break
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment