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/png: panic in Decode #19553
Comments
Can you share the source file? |
This is the hex values of the
|
Just started fuzzing image/png, and it took about an hour to get the very same crasher. |
Seems like the last time |
CL https://golang.org/cl/38271 mentions this issue. |
hi @gopherbot , i get the sam err. |
@hyhlinux, if you still get an error, please file a new (and complete) bug report, including details of which version of Go you're using. This issue is closed and replies are not necessarily tracked. |
Reopening until it's fixed in the release branch. |
Wait, so this never worked, right? If it's not a regression from Go 1.7, it's not for the point release. |
It's kind of a regression in that an error turned into a panic. But the CL turns it into working code. I'm not happy about adding new functionality in a point release.
I will send a CL for the release branch that restores the old error instead. New functionality can wait for Go 1.9. |
I just discovered the same.
|
CL https://golang.org/cl/39593 mentions this issue. |
Cherry-pick submitted. |
…rent gray8 images Go 1.7 and earlier rejected these images with chunkOrderError. Go 1.8 panicked during decoding. Go 1.9 will handle them successfully. Make Go 1.8.1 match Go 1.7 and earlier, to remove the panic without introducing new functionality in a minor release. Fixes #19553. Change-Id: I3c73a27aa3932300326273b6b563cdf606f3ab64 Reviewed-on: https://go-review.googlesource.com/39593 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
For the record, the Go 1.8 release notes at https://golang.org/doc/go1.8 says:
and the "grayscale transparency" part of that was implemented by https://go-review.googlesource.com/32143, submitted October 2016. That feature had a panic'ing bug, fixed on tip by https://go-review.googlesource.com/38271, submitted March 2017. So by restoring Go 1.7's behavior, we are removing a feature (which admittedly had a panic'ing bug) that we added in Go 1.8.0. I'm not saying that restoring Go 1.7's behavior is wrong. I'm just making sure that everyone's clear on the context. |
Oh. That makes me less happy about the cherry-pick. Is there a middle ground option between removing features and adding features, whereby we just return an error instead of panicking? Looking at 16663a8, maybe just return an error if |
On a closer inspection, rsc's cherry-pick only affects Gray8 transparency, not all grayscale transparency. To repeat, it does not affect Gray1, Gray2, Gray4 or Gray16 transparency. So it's not a big of a rollback as I first feared. Such Gray8 transparent images never worked in Go 1.8.0. Non-8 images, such as Gray1, will continue to decode without error in 1.8.1 as they did in 1.8.0. Still, it's a little weird in 1.8.x for G1, G2, G4 and G16 to all work, but G8 to return an error. |
@rsc says: "I think it's fine to leave as is (returning an error). That code path never worked. I do see the discrepancy with the other gray depths, but those are the ones that actually got implemented for Go 1.8, and this one didn't." |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
Calling png.Decode panicked at
image/png.(*decoder).readImagePass
, here's the call stack:Looking at
image/png/reader.go:615
, I think it might be because ofgray
was nil.gray
was only initialized before on line 438, in the case of!d.useTransparent
, so whend.useTransparent == true
and it's thecbG8
case, it might panic. (I'm no PNG expert so I'm not sure whether that's a case that's not supposed to happen)What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: