Comments (12)
Is it possible to tell me how to reproduce the error?
If the problematic file is publicly accessible, it will be helpful if you let me know its URL.
I tried to decode some gzip files downloaded from s3 (e.g., emsdk-portable.tar.gz ), but no problem was found.
from libflate.
Sorry there're some sensitive data inside the file so I cannot give it to you directly.
I added these to huffman.rs: 97 and saw some interesting results.
for padding in 0..(1 << (self.max_bitwidth - code.width)) {
let i = ((padding << code.width) | code_be.bits) as usize;
if i == 0 {
println!("
symbol: {}
code: Code {{ width: {}, bits: {:b} }}
code_be.bits: {:b}
i: {}
self.max_bitwidth: {}
padding: {}
value: {}",
symbol,
code.width,
code.bits,
code_be.bits,
i,
self.max_bitwidth,
padding,
value)
}
debug_assert_eq!(self.table[i], MAX_BITWIDTH as u16 + 1);
unsafe {
*self.table.get_unchecked_mut(i) = value;
}
Prints:
symbol: 0
code: Code { width: 3, bits: 0 }
code_be.bits: 0
i: 0
self.max_bitwidth: 7
padding: 0
value: 3
symbol: 48
code: Code { width: 5, bits: 0 }
code_be.bits: 0
i: 0
self.max_bitwidth: 15
padding: 0
value: 1541
symbol: 230
code: Code { width: 13, bits: 10000000000000 }
code_be.bits: 0
i: 0
self.max_bitwidth: 15
padding: 0
value: 7373
It seems like the index 0 has been repeatedly used.
from libflate.
Thank you for your information.
It seems like the index 0 has been repeatedly used.
Typically, it indicates that "the input data is broken".
DecoderBuilder::set_mapping
method (and its callers) tries to reconstruct huffman codes from the canonical huffman codes stored in the input data.
But for some reason, the canonical huffman codes have used overlapped (conflicted) bits spaces for different symbols (so the assertion raised).
Of course, the cause may be simply a bug in the libflate
.
But, unfortunately, there is no sufficient information to determine the exact reason of the error ... .
from libflate.
from libflate.
Hmm... .
I can not do it for a while because I do not have time, but if I can afford, I will try to reproduce it in my environment.
from libflate.
from libflate.
Thanks!
from libflate.
FYI, I fixed a bug (at the commit a03c2f3 ) which seems the cause of the problem reported by this issue.
from libflate.
from libflate.
Thanks!
I hope this will solve your problem.
from libflate.
Great, I can confirm the bug have been fixed! Thanks for your help!
from libflate.
Good!
Thank you for confirmation.
(And sorry for the inconvenience for a long time)
from libflate.
Related Issues (20)
- Decoder may expose contents of uninitialized memory in the output HOT 5
- Use-after-free on panic in client code HOT 4
- Remove byteorder-dependency HOT 1
- Possible concurrency issue during deflate on libflate 0.1.25 HOT 8
- Convenience functions? HOT 1
- btype 0x11 of DEFLATE is reserved(error) value HOT 1
- LZ77 compressor as a separate crate? HOT 3
- libflate 1.0.0 is on crates.io, but not here HOT 1
- Encoder panic on specific input data... HOT 1
- Compression level HOT 5
- UnexpectedEof encountered when decompressing data HOT 4
- Streaming data extensions HOT 4
- LZ77 decoder? HOT 2
- libflate::gzip::Decoder::read does not handle zero-length buffer properly HOT 2
- UB in the public safe API - where to report? HOT 4
- Panic in `bug` when parsing malformed file HOT 4
- GzDecoder seem decode incorrect HOT 9
- Error while decoding just encoded data HOT 2
- zLib decoding fails with failed to fill whole buffer HOT 6
- MultiGzDecoder with non-gzip bytes at end
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 libflate.