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: mishandles progressive JPEG #6767

gopherbot opened this issue Nov 14, 2013 · 6 comments

image/jpeg: mishandles progressive JPEG #6767

gopherbot opened this issue Nov 14, 2013 · 6 comments


Copy link

by dan.pupius:

To reproduce:
- decode the attached image

What is the expected output?

A decoded image.  Works in every other image viewer I tried.  (Preview, Chrome,

What do you see instead?

invalid JPEG format: missing 0xff00 sequence

Which version are you using?  (run 'go version')

go version devel +37afbf6361e2 Tue Nov 12 10:03:13 2013 -0800 darwin/amd64
Which version are you using?  (run 'go version')

I realize this is an expected error, but given that other viewers manage to decode the
image correctly I wonder if this is truly an error case or can be gracefully handled. 
(Pardon my ignorance of the jpeg spec)


  1. 0*CZbFf74phRAk3ngZ.jpeg (615890 bytes)
Copy link

adg commented Nov 14, 2013

Comment 1:

Labels changed: added priority-someday, removed priority-triage.

Owner changed to @nigeltao.

Copy link

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

Copy link

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

Copy link

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

Copy link

robpike commented Dec 17, 2013

Comment 5:

The file is a progressive JPEG, a feature only recently supported. The error occurs in
the first scan decoding the huffman block. I suspect the problem is just a bug in the
new code. If Nigel doesn't get to it first, I'll dig into it when I have my JPEG
standard book handy.
Other tests I've run show this to be a syntactically correct JPEG. Here's the dump of
the piece through the first scan section.
APP0 len=16
DQT:    p = 0, table = 0
DQT:    p = 0, table = 1
SOF2:   Progressive DCT - Huffman coding
    990 wide, 1345 high, 8 deep, 3 components
    component 1: 2 hsample, 2 vsample, quantization table 0
    component 2: 1 hsample, 1 vsample, quantization table 1
    component 3: 1 hsample, 1 vsample, quantization table 1
DHT:    class = 0, table = 0
SOS:    1 components
    component 1: 0 DC, 0 AC
    start spectral 0
    end spectral 0
    ah = 0, al = 0
sequence length 22370 with 35 stuffs
Should be fixed for Go 1.3 if possible. I suspect this isn't the only file that causes
the problem.

Labels changed: added release-go1.3, removed priority-someday, release-none.

Status changed to Accepted.

Copy link

Comment 7:

This issue was closed by revision ea34ca7.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 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

5 participants