From fbfaf5aeec279cf2c567bfebb4ae64bc1140a32e Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Fri, 13 Sep 2024 10:28:06 -0700 Subject: [PATCH] Handle skip frame errors. --- src/symbolize/gimli/elf.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/symbolize/gimli/elf.rs b/src/symbolize/gimli/elf.rs index bf088f8d..b73f6aac 100644 --- a/src/symbolize/gimli/elf.rs +++ b/src/symbolize/gimli/elf.rs @@ -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 {