We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 258cf44 commit 6157daaCopy full SHA for 6157daa
src/deflate/symbol.rs
@@ -399,7 +399,14 @@ impl HuffmanCodec for DynamicHuffmanCodec {
399
.or_else(|| literal_code_bitwidthes.last().cloned());
400
distance_code_bitwidthes.extend(load_bitwidthes(reader, c, last)?);
401
}
402
- debug_assert_eq!(distance_code_bitwidthes.len(), distance_code_count as usize);
+ if distance_code_bitwidthes.len() > distance_code_count as usize {
403
+ let message = format!(
404
+ "The length of `distance_code_bitwidthes` is too large: actual={}, expected={}",
405
+ distance_code_bitwidthes.len(),
406
+ distance_code_count
407
+ );
408
+ return Err(io::Error::new(io::ErrorKind::InvalidData, message));
409
+ }
410
411
Ok(Decoder {
412
literal: huffman::DecoderBuilder::from_bitwidthes(
0 commit comments