image/png: panic whilst decoding png #22304
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.9.1
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH=amd64
GOOS=linux
What did you do?
Run the program at: https://play.golang.org/p/yibwQ0ST5z
What did you expect to see?
An error message returned by png.Decode to be printed
What did you see instead?
panic: runtime error: makeslice: len out of range
This is caused by an integer overflow when multiplying the width of the image by the height, and subsequently trying to allocated a slice with a negative element count. image.New*() functions should probably guard against integer overflow before calling make().
I would like to try to write the fix.
NOTE: this only panics on 64 bit architectures, hence does not panic on the playground.
The text was updated successfully, but these errors were encountered: