Skip to content

image/jpeg: Decode errors reading from the network #9127

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

Closed
bradfitz opened this issue Nov 19, 2014 · 4 comments
Closed

image/jpeg: Decode errors reading from the network #9127

bradfitz opened this issue Nov 19, 2014 · 4 comments

Comments

@bradfitz
Copy link
Contributor

The following program sometimes fails (with jpeg.errMissingFF00) and sometimes succeeds:

package main

import (
    "image/jpeg"
    "log"
    "net/http"
)

func main() {
    res, err := http.Get("https://blog.golang.org/go-programming-language-turns-two_gophers.jpg";)
    if err != nil {
        log.Fatal(err)
    }
    if res.StatusCode != 200 {
        log.Fatal(res.Status)
    }
    if _, err := jpeg.Decode(res.Body); err != nil {
        log.Fatal(err)
    }
}

It depends on timing & how the network packets arrive.

The errors and intermixed successes:

mac:~ bradfitz$ go run d.go
2014/11/18 18:00:19 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:20 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:23 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:24 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
mac:~ bradfitz$ go run d.go
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:28 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:30 invalid JPEG format: missing 0xff00 sequence
exit status 1
mac:~ bradfitz$ go run d.go
2014/11/18 18:00:31 invalid JPEG format: missing 0xff00 sequence
exit status 1

I suspect a problem with the interaction between the jpeg package's buffering and its
huffman reader.
@gopherbot
Copy link
Contributor

Comment 1:

CL https://golang.org/cl/178120043 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Nov 22, 2014

Comment 2:

This issue was closed by revision 0492304.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Nov 23, 2014

Comment 3:

This issue was closed by revision 926c82fb5dad.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@rsc rsc removed this from the Go1.5 milestone Dec 18, 2014
@rsc
Copy link
Contributor

rsc commented Dec 18, 2014

This was fixed in Go 1.4.

rsc added a commit that referenced this issue May 11, 2015
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes #9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes golang#9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes golang#9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes golang#9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 20, 2018
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes golang#9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
…= nil in d.fill

««« CL 178120043 / 95f5614b4648
image/jpeg: handle Read returning n > 0, err != nil in d.fill

Fixes golang#9127.

LGTM=r
R=bradfitz, r
CC=golang-codereviews, nigeltao
https://golang.org/cl/178120043
»»»

TBR=r
CC=golang-codereviews
https://golang.org/cl/181870043
@rsc rsc unassigned robpike Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants