File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -358,10 +358,22 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
358
358
}
359
359
360
360
fn decompress_zstd ( mut input : & [ u8 ] , mut output : & mut [ u8 ] ) -> Option < ( ) > {
361
+ use ruzstd:: frame:: ReadFrameHeaderError ;
362
+ use ruzstd:: frame_decoder:: FrameDecoderError ;
361
363
use ruzstd:: io:: Read ;
362
364
363
365
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
+ } ;
365
377
loop {
366
378
let bytes_written = decoder. read ( output) . ok ( ) ?;
367
379
if bytes_written == 0 {
You can’t perform that action at this time.
0 commit comments