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: EOF error when decoding image file instead of ErrUnexpectedEOF #56724
Labels
Milestone
Comments
joedian
added
the
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
label
Nov 14, 2022
Why 24 bytes and where is the attachment file? |
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Nov 21, 2022
Decoder's readByte did not check io.EOF returned by fill. Fixes golang#56724
Change https://go.dev/cl/452335 mentions this issue: |
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Nov 21, 2022
Decoder calls fill from readFull, ignore and readByte and readByte did not check io.EOF returned by fill. Fixes golang#56724
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Nov 21, 2022
Decoder calls fill from readFull, ignore and readByte and readByte did not check returned io.EOF. This change moves io.EOF translation inside fill as io.EOF can only happen when underlying reader returns zero bytes which is unexpected. Fixes golang#56724
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Jan 27, 2023
Decoder calls fill from readFull, ignore and readByte and readByte did not check returned io.EOF. This change moves io.EOF translation inside fill as io.EOF can only happen when underlying reader returns zero bytes which is unexpected. name old time/op new time/op delta DecodeBaseline-8 917µs ± 0% 919µs ± 0% +0.21% (p=0.000 n=16+19) DecodeProgressive-8 1.42ms ± 0% 1.42ms ± 0% +0.05% (p=0.012 n=17+19) name old speed new speed delta DecodeBaseline-8 67.4MB/s ± 0% 67.3MB/s ± 0% -0.20% (p=0.000 n=16+19) DecodeProgressive-8 43.7MB/s ± 0% 43.6MB/s ± 0% -0.06% (p=0.013 n=17+19) name old alloc/op new alloc/op delta DecodeBaseline-8 63.0kB ± 0% 63.0kB ± 0% ~ (all equal) DecodeProgressive-8 260kB ± 0% 260kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta DecodeBaseline-8 5.00 ± 0% 5.00 ± 0% ~ (all equal) DecodeProgressive-8 13.0 ± 0% 13.0 ± 0% ~ (all equal) Fixes golang#56724
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Jan 28, 2023
Decoder calls fill from readFull, ignore and readByte and readByte did not check returned io.EOF. This change moves io.EOF translation inside fill as io.EOF can only happen when underlying reader returns zero bytes which is unexpected. name old time/op new time/op delta DecodeBaseline-8 917µs ± 0% 919µs ± 0% +0.21% (p=0.000 n=16+19) DecodeProgressive-8 1.42ms ± 0% 1.42ms ± 0% +0.05% (p=0.012 n=17+19) name old speed new speed delta DecodeBaseline-8 67.4MB/s ± 0% 67.3MB/s ± 0% -0.20% (p=0.000 n=16+19) DecodeProgressive-8 43.7MB/s ± 0% 43.6MB/s ± 0% -0.06% (p=0.013 n=17+19) name old alloc/op new alloc/op delta DecodeBaseline-8 63.0kB ± 0% 63.0kB ± 0% ~ (all equal) DecodeProgressive-8 260kB ± 0% 260kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta DecodeBaseline-8 5.00 ± 0% 5.00 ± 0% ~ (all equal) DecodeProgressive-8 13.0 ± 0% 13.0 ± 0% ~ (all equal) Fixes golang#56724
AlexanderYastrebov
added a commit
to AlexanderYastrebov/go
that referenced
this issue
Feb 4, 2023
Decoder calls fill from readFull, ignore and readByte and readByte did not check returned io.EOF. This change moves io.EOF translation inside fill. name old speed new speed delta DecodeBaseline-8 67.4MB/s ± 0% 67.3MB/s ± 0% -0.20% (p=0.000 n=16+19) DecodeProgressive-8 43.7MB/s ± 0% 43.6MB/s ± 0% -0.06% (p=0.013 n=17+19) Fixes golang#56724
dmitshur
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Feb 24, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Here is a sample code to reproduce an EOF error:
EOF error occurs when processing the first 24 bytes of the attachment file with the sample code.
head -c24 1x1.jpg | go run main.go
What did you expect to see?
I want to return ErrUnexpectedEOF if err is EOF as follows
What did you see instead?
image.Decode returned an EOF error.
The text was updated successfully, but these errors were encountered: