-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/image/tiff: index out of range #11386
Comments
This file looks corrupt to me. This Tiff has 6 tiles (150 x 100) and decoding chokes on the 3rd tile with x/image/tiff. The actual reason: corrupt lzw data |
@hhrutter, if the file is corrupt, the |
Decoding this image first hits this line: And next code decoding hits this: Using I trying to create simple test without adding corrupted file to repo, but this is complicated case and I have not succeeded yet. Maybe in this case is ok to add file to repo? P.S. |
@bsiegert may be able to give some input. |
Having corrupted image files as part of the test suite seems sensible, if for no other reason than to test the error paths. |
I don't think that
and, crucially, the +1 isn't in the stdlib's I'm still thinking about how best to fix the x/image/variant. To repeat what bcmills@ said, we should definitely return an error, not panic. |
Ah, the stdlib's https://go-review.googlesource.com/c/go/+/42032/ The second of these (45111) is trivial to copy across, and should fix the immediate problem. The first of these (42032) should also be copied across at some point, but it might need a little more thinking. |
Change https://golang.org/cl/191221 mentions this issue: |
As for why the stdlib version now needs an explicit Anyway, as I said, 42032 should also be copied across, but it needs a little more thinking. |
I have a question. If stdlib and x/iamge version should be the same except +1 thing, and we struggling to apply patches to both versions, why we can't remove x/image version and add something like |
This does for x/image what https://go-review.googlesource.com/c/go/+/45111/ did for the standard library's compress/lzw. The x variant is a fork of the stdlib, with an extra, explicit tweak because the TIFF format is "off by one" - a mistake (not Go specific) somebody introduced decades ago and that we can never fix, given all the existing TIFF files out there in the wild. When previously patching the stdlib variant, I was supposed to also patch the x variant, but forgot. Updates golang/go#11386 Change-Id: Ic74f9014d2d048ee12cdd151332db62b76f1cde2 Reviewed-on: https://go-review.googlesource.com/c/image/+/191221 Reviewed-by: Bryan C. Mills <[email protected]>
The performance penalty would have to be measured. It's not just one "if", it's one "if" in the inner loop. But in general, putting TIFF's off-by-one into the stdlib's |
This does for x/image what https://go-review.googlesource.com/c/go/+/45111/ did for the standard library's compress/lzw. The x variant is a fork of the stdlib, with an extra, explicit tweak because the TIFF format is "off by one" - a mistake (not Go specific) somebody introduced decades ago and that we can never fix, given all the existing TIFF files out there in the wild. When previously patching the stdlib variant, I was supposed to also patch the x variant, but forgot. Updates golang/go#11386 Change-Id: Ic74f9014d2d048ee12cdd151332db62b76f1cde2 Reviewed-on: https://go-review.googlesource.com/c/image/+/191221 Reviewed-by: Bryan C. Mills <[email protected]>
This does for x/image what https://go-review.googlesource.com/c/go/+/45111/ did for the standard library's compress/lzw. The x variant is a fork of the stdlib, with an extra, explicit tweak because the TIFF format is "off by one" - a mistake (not Go specific) somebody introduced decades ago and that we can never fix, given all the existing TIFF files out there in the wild. When previously patching the stdlib variant, I was supposed to also patch the x variant, but forgot. Updates golang/go#11386 Change-Id: Ic74f9014d2d048ee12cdd151332db62b76f1cde2 Reviewed-on: https://go-review.googlesource.com/c/image/+/191221 Reviewed-by: Bryan C. Mills <[email protected]>
This does for x/image what https://go-review.googlesource.com/c/go/+/45111/ did for the standard library's compress/lzw. The x variant is a fork of the stdlib, with an extra, explicit tweak because the TIFF format is "off by one" - a mistake (not Go specific) somebody introduced decades ago and that we can never fix, given all the existing TIFF files out there in the wild. When previously patching the stdlib variant, I was supposed to also patch the x variant, but forgot. Updates golang/go#11386 Change-Id: Ic74f9014d2d048ee12cdd151332db62b76f1cde2 Reviewed-on: https://go-review.googlesource.com/c/image/+/191221 Reviewed-by: Bryan C. Mills <[email protected]>
The following program:
on this file:
https://drive.google.com/file/d/0B20Uwp8Hs1oCdDhyRzAwbE5qc2M/view?usp=sharing
crashes as follows:
on commit eb11b45157c1b71f30b3cec66306f1cd779a689e
go version devel +3cab476 Sun Jun 21 03:11:01 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: