Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

alainv opened this issue Sep 14, 2012 · 2 comments


Copy link

alainv commented Sep 14, 2012

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  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.


What steps will reproduce the problem?
If possible, include a link to a program on
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)?

Which operating system are you using?

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@.
Copy link

robpike commented Sep 14, 2012

Comment 1:

Labels changed: added priority-later, packagebug, removed priority-triage.

Owner changed to @nigeltao.

Status changed to Accepted.

Copy link

Comment 2:

This issue was closed by revision 648c9eb.

Status changed to Fixed.

nigeltao added a commit that referenced this issue May 11, 2015
…iling restart marker.

««« backport 7af3dbecf445
image/jpeg: ignore an incorrect but harmless trailing restart marker.

Fixes #4084.


@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

4 participants