This rolls back most of golang.org/cl/8841, aka 2f98bac, and makes a
different fix. It keeps the TestTruncatedSOSDataDoesntPanic test
introduced by that other CL, which obviously still passes after this CL.
Fixes#11650, a regression (introduced by cl/8841) from Go 1.4.
The original cl/8841 changed the image/jpeg not to panic on an input
given in #10387. We still do not panic on that input, after this CL.
I have a corpus of over 160,000 JPEG images, a sample of a web crawl.
The image/jpeg code ran happily over that whole corpus both before and
after this CL, although that corpus clearly didn't catch the regression
in the first place.
This code was otherwise tested manually. I don't think that it's trivial
to synthesize a JPEG input that happens to run out of Huffman data at
just the right place. The test image attached to #11650 obviously has
that property, but I don't think we can simply add that test image to
the repository: it's 227KiB, and I don't know its copyright status.
I also looked back over the issue tracker for problematic JPEGs that
people have filed. The Go code, after this CL, is still happy on these
files in my directory:
There were other images attached in the issue tracker that aren't
actually valid JPEGs. They failed both before and after this CL:
In summary, this CL fixes#11650 and, after some automated and manual
testing, I don't think introduces new regressions.
Reviewed-by: Rob Pike <firstname.lastname@example.org>
Run the following program on the following input:
It crashes with:
My repository is on commit 8ac129e.
The text was updated successfully, but these errors were encountered: