Comments (4)
Hello, speaking for the bzip2-rs
crate the issue is that this file is a multistream bzip2 file, which we don't support yet. You can verify that by putting a println here and you'll see the end-of-stream is reached even though we didn't reach the end-of-file.
from bzip2-rs.
@paolobarbolini Hello, thanks for reply. I want to add it to bzip2-rs
, but it seems to be a breaking change. In my view, we should remove ReadState::Eof
entirely, since Decoder
can never know that the end of file happened (it can only know that the end of block happened). Instead, DecoderReader
should check for the end of file in the original stream (which it doesn't do now, and actually it seems to me that it can get stuck in infinite loop of feeding zero bytes to Decoder
on some corrupted files which contain the header but end abruptly).
In any case, I'm more interested in pure Rust crate, so I suggest to create an issue there and continue our discussion of this there if possible.
And btw, I found a place where it is handled in the reference implementation: https://gitlab.com/federicomenaquintero/bzip2/-/blob/master/bzip2.c#L455 If you change this line to unconditional break;
, bzip2 starts to give identical result to these crates.
from bzip2-rs.
I opened an issue over at my repo paolobarbolini/bzip2-rs#5 @ygyzys.
from bzip2-rs.
OK, and I'll close the issue here, because I missed that there is a MultiBzDecoder
class in this crate. A bit confusing though: I don't see any reason why this should be a separate class from BzDecoder
, since its functionality is strictly superior, and performance overhead for checking the end of block is hardly an issue.
from bzip2-rs.
Related Issues (20)
- Is is possible to assume libbz2 is already linked? HOT 3
- Unclear how to cross-compile to Windows MSVC target from Linux HOT 1
- bzip2 source is outdated
- bzip2-sys: features=["static"]?
- failed to run custom build command for `bzip2-sys v0.1.8+1.0.8` HOT 3
- Could you publish a release? HOT 2
- Filesize mismatch when decompressing multi-stream with sizes greater than 2GB (2^31) HOT 6
- Update for futures 0.3
- Doesn't seem to have a "raw" module as mentioned in documentation / code comments HOT 1
- Failed to run custom build command for `bzip2-sys v0.1.11+1.0.8` HOT 3
- Implement tokio::io::AsyncBufRead for bufread::* types HOT 1
- bz_internal_error exported HOT 1
- build android fail HOT 2
- Bzip2-sys does not support the value 0 for blockSize100k
- Way to know how many compressed bytes were read when decompressing
- WASM support HOT 3
- Potential undefined behavior from cyclic references between `bz_stream` and `EState`/`DState`.
- Infinite loop writing an empty buffer in write::BzDecoder
- Infinite loop after decoding error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bzip2-rs.