Skip to content

Commit

Permalink
Merge branch 'master' into fuzz-progressive-sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0methean authored Jul 15, 2024
2 parents be6a46e + 8656826 commit dc1d596
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/read/xz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ impl<R: Read> Read for XzDecoder<R> {
}
digest.update(&b);
}
let mut b = vec![0u8; header_end - *reader.count];
let Some(padding_bytes) = header_end.checked_sub(*reader.count) else {
return error("Invalid XZ block header (too short)");
};
let mut b = vec![0u8; padding_bytes];
reader.read_exact(b.as_mut_slice())?;
if !b.iter().all(|&b| b == 0) {
return error("Invalid XZ block header padding");
Expand Down

0 comments on commit dc1d596

Please sign in to comment.