dyz1990 / sevenz-rust

A 7z decompressor/compressor lib written in pure rust
Apache License 2.0
153 stars 24 forks source link

Corrupted data on write, results in `dist overflow` error on read. #12

Closed nlfiedler closed 1 year ago

nlfiedler commented 1 year ago

Encountered an issue when writing binary files to a compressed archive. Didn't notice it with the text files I was using during testing. Not sure if it's certain kinds of binary files or something else, but sevenz-rust produces corrupted files that 7-zip cannot read. Attempting to decompress these files with sevenz-rust results in a dist overflow error. Since the reproduction involves a 1mb file, I've created a repository with the example code and PDF file.

https://github.com/nlfiedler/sevenz-overflow

I'm using rustc 1.67 and the latest sevenz-rust crate. I'm hoping I'm just doing it wrong and you will point out my error. Thank you.

dyz1990 commented 1 year ago

@nlfiedler You are right. There are bugs in the lzma encoder. I'll fix these bugs and release 0.2.6

dyz1990 commented 1 year ago

@nlfiedler this issues is fixed in version 0.2.6,with sub crate lzma-rust 0.1.1. Thanks for reporting this issue.

nlfiedler commented 1 year ago

I've verified with my test and it works. Thank you.