File tree 1 file changed +18
-3
lines changed 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -357,11 +357,26 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
357
357
}
358
358
}
359
359
360
- fn decompress_zstd ( input : & [ u8 ] , output : & mut [ u8 ] ) -> Option < ( ) > {
360
+ fn decompress_zstd ( mut input : & [ u8 ] , mut output : & mut [ u8 ] ) -> Option < ( ) > {
361
361
use ruzstd:: io:: Read ;
362
362
363
- let mut decoder = ruzstd:: StreamingDecoder :: new ( input) . ok ( ) ?;
364
- decoder. read_exact ( output) . ok ( )
363
+ while !input. is_empty ( ) {
364
+ let mut decoder = ruzstd:: StreamingDecoder :: new ( & mut input) . ok ( ) ?;
365
+ loop {
366
+ let bytes_written = decoder. read ( output) . ok ( ) ?;
367
+ if bytes_written == 0 {
368
+ break ;
369
+ }
370
+ output = & mut output[ bytes_written..] ;
371
+ }
372
+ }
373
+
374
+ if !output. is_empty ( ) {
375
+ // Lengths didn't match, something is wrong.
376
+ return None ;
377
+ }
378
+
379
+ Some ( ( ) )
365
380
}
366
381
367
382
const DEBUG_PATH : & [ u8 ] = b"/usr/lib/debug" ;
You can’t perform that action at this time.
0 commit comments