Skip to content

image/jpeg: unable to decode jpeg image with error: "unsupported JPEG feature: unknown marker" #4084

@alainv

Description

@alainv
Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Open a JPEG file using: os.Open("<PATH/TO/IMAGE.jpg>")
2. Try to decode the file with: image.Decode(imgf)

What is the expected output?
JPEG file successfully decoded.

What do you see instead?
Error: unsupported JPEG feature: unknown marker

Which compiler are you using (5g, 6g, 8g, gccgo)?
N/A

Which operating system are you using?
Linux

Which version are you using?  (run 'go version')
go version go1.0.2

Please provide any additional information below.

I modified image/jpeg/reader.go to print some more information and the unknown marker is
"0xd5" which is a restart marker that should be parsed in the processSOS
function. It seems that the function is not going far enough in the file and misses the
restart marker.

Before getting into processSOS, this is the list of markers I get in decode:

2012/09/14 18:10:01 Got marker: e1
2012/09/14 18:10:01 Got marker: db
2012/09/14 18:10:01 Got marker: c4
2012/09/14 18:10:01 Got marker: dd
2012/09/14 18:10:01 Got marker: c0
2012/09/14 18:10:01 Got marker: da

Output from jpeginfo -c:
  2592 x 1944 24bit Exif  N 1143840  [OK]

No image attached on the bug but sent directly to nigeltao@.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions