Skip to content

Commit fbfaf5a

Browse files
committed
Handle skip frame errors.
1 parent e5473c3 commit fbfaf5a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: src/symbolize/gimli/elf.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,22 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
358358
}
359359

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

363365
while !input.is_empty() {
364-
let mut decoder = ruzstd::StreamingDecoder::new(&mut input).ok()?;
366+
let mut decoder = match ruzstd::StreamingDecoder::new(&mut input) {
367+
Ok(decoder) => decoder,
368+
Err(FrameDecoderError::ReadFrameHeaderError(ReadFrameHeaderError::SkipFrame {
369+
length,
370+
..
371+
})) => {
372+
input = &input.get(length as usize..)?;
373+
continue;
374+
}
375+
Err(_) => return None,
376+
};
365377
loop {
366378
let bytes_written = decoder.read(output).ok()?;
367379
if bytes_written == 0 {

0 commit comments

Comments
 (0)