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: CCITT reader fails to return last row of data #34809
Comments
Change https://golang.org/cl/200162 mentions this issue: |
The others, @hhrutter and @bsiegert deserve more thanks than me.
This is possibly related to https://go-review.googlesource.com/c/image/+/198547 which @hhrutter has coincidentally also sent out recently. As for this issue (and CL 200162), perhaps @hhrutter and @bsiegert can take a first look at this and how it relates to CL 198547. I'm busier than usual with other things for the next few weeks. |
This issue should be taken care of by CL 201938. @dchang-dchang just for verification, please state which file of libtiff/images was giving you problems. |
Great! Totally agree that Cl 201938 will address this. g3test.tif is the file that I was using. Thanks! |
Change https://golang.org/cl/201938 mentions this issue: |
Change https://golang.org/cl/211037 mentions this issue: |
The new bw-gopher-truncatedX.ccitt_groupY files were derived from the existing bw-gopher.ccitt_groupY files, after dropping the final 6 consecutive EOL's or 2 consecutive EOL's (depending on whether Y is 3 or 4) and then padding to a byte boundary with either all 0 bits or all 1 bits (depending on X). Each EOL code is 12 bits long: 0000_0000_0001. Fixes golang/go#34809 Change-Id: Ibb2d964b5205b28f5e2adb5d30647b92aec53c77 Reviewed-on: https://go-review.googlesource.com/c/image/+/211037 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Horst Rutter <hhrutter@gmail.com> Run-TryBot: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
The new bw-gopher-truncatedX.ccitt_groupY files were derived from the existing bw-gopher.ccitt_groupY files, after dropping the final 6 consecutive EOL's or 2 consecutive EOL's (depending on whether Y is 3 or 4) and then padding to a byte boundary with either all 0 bits or all 1 bits (depending on X). Each EOL code is 12 bits long: 0000_0000_0001. Fixes golang/go#34809 Change-Id: Ibb2d964b5205b28f5e2adb5d30647b92aec53c77 Reviewed-on: https://go-review.googlesource.com/c/image/+/211037 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Horst Rutter <hhrutter@gmail.com> Run-TryBot: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
The new bw-gopher-truncatedX.ccitt_groupY files were derived from the existing bw-gopher.ccitt_groupY files, after dropping the final 6 consecutive EOL's or 2 consecutive EOL's (depending on whether Y is 3 or 4) and then padding to a byte boundary with either all 0 bits or all 1 bits (depending on X). Each EOL code is 12 bits long: 0000_0000_0001. Fixes golang/go#34809 Change-Id: Ibb2d964b5205b28f5e2adb5d30647b92aec53c77 Reviewed-on: https://go-review.googlesource.com/c/image/+/211037 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Horst Rutter <hhrutter@gmail.com> Run-TryBot: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
This reproduces on the master branch of
x/image
.What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
What did you see instead?
First, thank you @nigeltao and others for your work on the CCITT Group3 TIFF reader. Really coming in handy right as we're trying to parse TIFF fax files!
Second, let me preface this with the face that I had never heard of CCITT before this morning. I'm likely to have gotten a bunch wrong so for that, thanks for your patience and help!
The TLDR is that I think the CCITT reader is, in certain cases, decoding but not "packing" the last line
It happens when the io.Reader returns n bytes and also a io.EOF error [0]. This causes the CCITT reader to break immediately, and thus doesn't actually pack and thus results in the last row not part of the returned bytes, causing the TIFF package to be confused by the missing data (
tiff: invalid format: not enough pixel data
).I found a group3 compressed tiff file from libtiff [1] that seems to exhibit this problem and the code in this PR [2] seems to address it.
Thanks for all the help!
Thanks!
David
[0] https://golang.org/pkg/io/#Reader
[1] See http://www.simplesystems.org/libtiff/images.html
[2] Created the PR first, but sounds like the issue tracker is here and so duplicating. Sorry for the noise and feel free to work off which ever one is convenient and we can close the other one.
The text was updated successfully, but these errors were encountered: