You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to decode the following file from the official zstd repo zeroSeq_2B.zst
Here can be seen how they actually do it zstd_repo.
The idea is to first extract the first byte, then check it to see if it is greater than "0x7F" and then after the usual read of the extra bytes, check if the result sequence_len is actually 0.
In the case of the aforementioned example it requires to read an extra byte (as first_byte = 128), and then the read byte is 0, so the result is sequence_len = 0, and the decoding should conclude with copying the content of the literals into the frame buffer.
Here is the result of the operation at the moment (at commit 48ac3e4):
cargo run --bin zstd -- ./golden-decompression/zeroSeq_2B.zst -d -c
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/zstd ./golden-decompression/zeroSeq_2B.zst -d -c`
File: ./golden-decompression/zeroSeq_2B.zst
Found Raw literalssection with regenerated size: 13, and compressed size: None
Slice for literals: 13
thread 'main' panicked at src/bin/zstd.rs:86:22:
called `Result::unwrap()` on an `Err` value: FailedToReadBlockBody(DecompressBlockError(SequencesHeaderParseError(NotEnoughBytes { need_at_least: 3, got: 2 })))note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The fix should be pretty straightforward, as is just a matter of the order of the if-checks.
The text was updated successfully, but these errors were encountered:
When trying to decode the following file from the official zstd repo zeroSeq_2B.zst
Here can be seen how they actually do it zstd_repo.
The idea is to first extract the first byte, then check it to see if it is greater than "0x7F" and then after the usual read of the extra bytes, check if the result sequence_len is actually 0.
In the case of the aforementioned example it requires to read an extra byte (as first_byte = 128), and then the read byte is 0, so the result is sequence_len = 0, and the decoding should conclude with copying the content of the literals into the frame buffer.
Here is the result of the operation at the moment (at commit 48ac3e4):
The fix should be pretty straightforward, as is just a matter of the order of the if-checks.
The text was updated successfully, but these errors were encountered: