]> Cypherpunks repositories - gostls13.git/commit
image/png: integer underflow when decoding
authorNathan Otterness <otternes@cs.unc.edu>
Sat, 19 Sep 2015 00:08:47 +0000 (20:08 -0400)
committerNigel Tao <nigeltao@golang.org>
Mon, 21 Sep 2015 23:09:22 +0000 (23:09 +0000)
commit66c25fa9beda429a1e32b6dc65e48f071569d841
tree08eb6a6e638da5fdeff5dad8b8563588c193fd05
parent980cb0caf258b468eca903df85c44224f3e7e5c5
image/png: integer underflow when decoding

This change addresses an integer underflow appearing only on systems
using a 32-bit int type. The patch addresses the problem by limiting the
length of unknown chunks to 0x7fffffff. This value appears to already be
checked for when parsing other chunk types, so the bug shouldn't appear
elsewhere in the package. The PNG spec recommends the maximum size for
any chunk to remain under 2^31, so this shouldn't cause errors with
valid images.

Fixes #12687

Change-Id: I17f0e1683515532c661cf2b0b2bc65309d1b7bb7
Reviewed-on: https://go-review.googlesource.com/14766
Reviewed-by: Nigel Tao <nigeltao@golang.org>
src/image/png/reader.go
src/image/png/reader_test.go