File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -76,16 +76,21 @@ fn run(input: &[u8]) -> Corpus {
76
76
let input_len: u64 = input. len ( ) . try_into ( ) . unwrap ( ) ;
77
77
stream. next_out = output. as_mut_ptr ( ) ;
78
78
stream. avail_out = output. len ( ) . try_into ( ) . unwrap ( ) ;
79
- stream. next_in = input. as_ptr ( ) ;
80
- stream. avail_in = input. len ( ) . try_into ( ) . unwrap ( ) ;
81
79
82
- while input_len. checked_sub ( stream. total_in ) . unwrap ( ) > 0 {
83
- let err = unsafe { inflate ( & mut stream, InflateFlush :: Finish as _ ) } ;
80
+ let chunk_size = 64 ;
81
+ for chunk in input. chunks ( chunk_size) {
82
+ stream. next_in = chunk. as_ptr ( ) as * mut u8 ;
83
+ stream. avail_in = chunk. len ( ) as _ ;
84
+
85
+ let err = unsafe { inflate ( & mut stream, InflateFlush :: NoFlush as _ ) } ;
84
86
match ReturnCode :: from ( err) {
85
87
ReturnCode :: StreamEnd => {
86
88
break ;
87
89
}
88
- ReturnCode :: BufError | ReturnCode :: Ok => {
90
+ ReturnCode :: Ok => {
91
+ continue ;
92
+ }
93
+ ReturnCode :: BufError => {
89
94
let add_space: u32 = Ord :: max ( 1024 , output. len ( ) . try_into ( ) . unwrap ( ) ) ;
90
95
output. resize ( output. len ( ) + add_space as usize , 0 ) ;
91
96
You can’t perform that action at this time.
0 commit comments