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: Decode errors reading from the network #9127

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
Assignees

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Nov 19, 2014

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

@gopherbot gopherbot commented Nov 21, 2014

Comment 1:

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

Loading

@rsc
Copy link
Contributor

@rsc rsc commented Nov 22, 2014

Comment 2:

This issue was closed by revision 0492304.

Status changed to Fixed.

Loading

@rsc
Copy link
Contributor

@rsc rsc commented Nov 23, 2014

Comment 3:

This issue was closed by revision 926c82fb5dad.

Loading

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

@rsc rsc commented Dec 18, 2014

This was fixed in Go 1.4.

Loading

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 added 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 added 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 added 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 added 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 added 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
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants