diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-04-17 22:10:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-04-17 22:10:58 +0000 |
commit | ea250f561291c184423c4372041c067f5233fa5c (patch) | |
tree | a190311458c423b71ed9f800fd5bd43faa7dccc3 /libgo/go/image | |
parent | 1adb82e11762ce349eeaee1051ea3c379a453b2e (diff) |
libgo: update to Go 1.8.1 release
Reviewed-on: https://go-review.googlesource.com/40775
From-SVN: r246957
Diffstat (limited to 'libgo/go/image')
-rw-r--r-- | libgo/go/image/png/reader.go | 5 | ||||
-rw-r--r-- | libgo/go/image/png/reader_test.go | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libgo/go/image/png/reader.go b/libgo/go/image/png/reader.go index 32f78f0ffe8..8299df56735 100644 --- a/libgo/go/image/png/reader.go +++ b/libgo/go/image/png/reader.go @@ -612,6 +612,11 @@ func (d *decoder) readImagePass(r io.Reader, pass int, allocateOnly bool) (image } } case cbG8: + if d.useTransparent { + // Match error from Go 1.7 and earlier. + // Go 1.9 will decode this properly. + return nil, chunkOrderError + } copy(gray.Pix[pixOffset:], cdat) pixOffset += gray.Stride case cbGA8: diff --git a/libgo/go/image/png/reader_test.go b/libgo/go/image/png/reader_test.go index b9e9f4d02c6..503b5dc567b 100644 --- a/libgo/go/image/png/reader_test.go +++ b/libgo/go/image/png/reader_test.go @@ -629,3 +629,13 @@ func BenchmarkDecodeRGB(b *testing.B) { func BenchmarkDecodeInterlacing(b *testing.B) { benchmarkDecode(b, "testdata/benchRGB-interlace.png", 4) } + +func TestIssue19553(t *testing.T) { + var buf = []byte{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x85, 0x2c, 0x88, 0x80, 0x00, 0x00, 0x00, 0x02, 0x74, 0x52, 0x4e, 0x53, 0x00, 0xff, 0x5b, 0x91, 0x22, 0xb5, 0x00, 0x00, 0x00, 0x02, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x87, 0x8f, 0xcc, 0xbf, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0a, 0xf0, 0x00, 0x00, 0x0a, 0xf0, 0x01, 0x42, 0xac, 0x34, 0x98, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xd5, 0x04, 0x02, 0x12, 0x11, 0x11, 0xf7, 0x65, 0x3d, 0x8b, 0x00, 0x00, 0x00, 0x4f, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0xff, 0xff, 0xff, 0xb9, 0xbd, 0x70, 0xf0, 0x8c, 0x01, 0xc8, 0xaf, 0x6e, 0x99, 0x02, 0x05, 0xd9, 0x7b, 0xc1, 0xfc, 0x6b, 0xff, 0xa1, 0xa0, 0x87, 0x30, 0xff, 0xd9, 0xde, 0xbd, 0xd5, 0x4b, 0xf7, 0xee, 0xfd, 0x0e, 0xe3, 0xef, 0xcd, 0x06, 0x19, 0x14, 0xf5, 0x1e, 0xce, 0xef, 0x01, 0x31, 0x92, 0xd7, 0x82, 0x41, 0x31, 0x9c, 0x3f, 0x07, 0x02, 0xee, 0xa1, 0xaa, 0xff, 0xff, 0x9f, 0xe1, 0xd9, 0x56, 0x30, 0xf8, 0x0e, 0xe5, 0x03, 0x00, 0xa9, 0x42, 0x84, 0x3d, 0xdf, 0x8f, 0xa6, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, + } + _, err := Decode(bytes.NewReader(buf)) + if err != chunkOrderError { + t.Errorf("Decode: expected chunkOrderError for transparent gray8, got %v", err) + } +} |