Skip to content

Commit

Permalink
Handle skip frame errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuey committed Sep 13, 2024
1 parent e5473c3 commit fbfaf5a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/symbolize/gimli/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,22 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
}

fn decompress_zstd(mut input: &[u8], mut output: &mut [u8]) -> Option<()> {
use ruzstd::frame::ReadFrameHeaderError;
use ruzstd::frame_decoder::FrameDecoderError;
use ruzstd::io::Read;

while !input.is_empty() {
let mut decoder = ruzstd::StreamingDecoder::new(&mut input).ok()?;
let mut decoder = match ruzstd::StreamingDecoder::new(&mut input) {
Ok(decoder) => decoder,
Err(FrameDecoderError::ReadFrameHeaderError(ReadFrameHeaderError::SkipFrame {
length,
..
})) => {
input = &input.get(length as usize..)?;
continue;
}
Err(_) => return None,
};
loop {
let bytes_written = decoder.read(output).ok()?;
if bytes_written == 0 {
Expand Down

0 comments on commit fbfaf5a

Please sign in to comment.