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/bzip2: Unexpected File Signature #42057
Comments
See https://github.com/dsnet/compress/raw/master/doc/bzip2-format.pdf, which is a reverse engineered specification from the C source code. Section 2.2.2. describes the stream header, which indicates that "BZ" is the magic for the file, and "h" is technically the version flag. |
Interesting, so are we confident that the original |
I'm not sure what this issue is trying to get at. While the internal implementation doesn't treat |
Okay, understood. I've just been working on an application that should be able to read many different types of files, and I just added support for |
Sounds like you learned what you need. Is there anything actionable to do for this issue or can we close it? |
Yep, that's all, thank you! I'll close it. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was working on a work-related project that utilized
compress/bzip2
to read files compressed withbzip2
. I noticed that thebzip2FileMagic
constant is set to0x425a
, or "BZ". My understanding is that every file passed into the reader checks for that heading to verify that it is a file that has been compressed withbzip2
before reading/decompressing the file.However, this source indicates that the file signature for
bzip2
is0x425a68
, or "BZh". Is there a source for where the shortened header used bycompress/bzip2
was derived from?What did you expect to see?
I expected to see const
bzip2FileMagic
to be set to0x425a68
, or "BZh".What did you see instead?
I saw the const
bzip2FileMagic
set to0x425a
, or "BZ".The text was updated successfully, but these errors were encountered: