-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
compress/lzw: compress/decompress corrupts data #11142
Comments
Is it because of width? |
I don't know too much about lzw, but comments say that the litWidth value controls the "number of bits to use for literal codes". Thus, if the value is set to 2, doesn't that mean you can only encode the literals 0x00, 0x01, 0x02, and 0x03? In fact, this seems to be what's happening since the above code works when uncomp is set to \x00, \x01, \x02, or \x03. It also seems that the incorrect output value is the input value modulo 4. If the encoder/decoder is working properly, maybe Write should output an error if the user tries to encode data with literals that are too large? In the horrendous off-chance that other formats depend on this degenerate behavior, then the library should at least document it? |
@dsnet Yes, this is my current understanding that there is no bug in the code. |
CL https://golang.org/cl/11063 mentions this issue. |
CL https://golang.org/cl/11227 mentions this issue. |
Fixes #11142. Change-Id: Id772c4364c47776d6afe86b0939b9c6281e85edc Reviewed-on: https://go-review.googlesource.com/11227 Reviewed-by: Russ Cox <[email protected]>
The following program fails with the panic:
go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: