diff --git a/src/image/jpeg/reader_test.go b/src/image/jpeg/reader_test.go index 2b03a465cc..77376152bc 100644 --- a/src/image/jpeg/reader_test.go +++ b/src/image/jpeg/reader_test.go @@ -207,13 +207,13 @@ func TestTruncatedSOSDataDoesntPanic(t *testing.T) { } } -func TestVeryLargeImageWithShortData(t *testing.T) { - // This input is an invalid JPEG image, generated by a fuzzer, as reported - // by issue 10413. It is only 504 bytes, and shouldn't take long for Decode +func TestLargeImageWithShortData(t *testing.T) { + // This input is an invalid JPEG image, based on the fuzzer-generated image + // in issue 10413. It is only 504 bytes, and shouldn't take long for Decode // to return an error. The Start Of Frame marker gives the image dimensions - // as 38655 wide and 16384 high, so even if an unreadByteStuffedByte bug - // doesn't technically lead to in an infinite loop, such a bug can still - // cause an unreasonably long loop for such a short input. + // as 8192 wide and 8192 high, so even if an unreadByteStuffedByte bug + // doesn't technically lead to an infinite loop, such a bug can still cause + // an unreasonably long loop for such a short input. const input = "" + "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x00\x00\x01" + "\x00\x01\x00\x00\xff\xdb\x00\x43\x00\x10\x0b\x0c\x0e\x0c\x0a\x10" + @@ -223,7 +223,7 @@ func TestVeryLargeImageWithShortData(t *testing.T) { "\x28\x1a\x18\x16\x16\x18\x31\x23\x25\x1d\x28\x3a\x33\x3d\x3c\x39" + "\x33\x38\x37\x40\x48\x5c\x4e\x40\x44\x57\x45\x37\x38\x50\x6d\x51" + "\x57\x5f\x62\x67\x68\x67\x3e\x4d\x71\x79\x70\x64\x78\x5c\x65\x67" + - "\x63\xff\xc0\x00\x0b\x08\x40\x00\x96\xff\x01\x01\x11\x00\xff\xc4" + + "\x63\xff\xc0\x00\x0b\x08\x20\x00\x20\x00\x01\x01\x11\x00\xff\xc4" + "\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00" + "\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff" + "\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04" + @@ -257,7 +257,7 @@ func TestVeryLargeImageWithShortData(t *testing.T) { if err == nil { t.Fatalf("got nil error, want non-nil") } - case <-time.After(10 * time.Second): + case <-time.After(3 * time.Second): t.Fatalf("timed out") } }