File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ impl CompressStream {
121
121
let op = BrotliEncoderOperation :: BROTLI_OPERATION_FINISH ;
122
122
let input = Vec :: new ( ) . into_boxed_slice ( ) ;
123
123
let mut available_in = 0 ;
124
- while BrotliEncoderIsFinished ( & mut self . state ) == 0 {
124
+ while BrotliEncoderIsFinished ( & mut self . state ) == 0 && available_out > 0 {
125
125
let ret = BrotliEncoderCompressStream (
126
126
& mut self . state ,
127
127
op,
@@ -141,8 +141,12 @@ impl CompressStream {
141
141
) ) ;
142
142
}
143
143
}
144
- output. truncate ( output_offset) ;
145
- self . result = BrotliStreamResult :: ResultSuccess as i32 ;
144
+ self . result = if available_out == 0 {
145
+ BrotliStreamResult :: NeedsMoreOutput as i32
146
+ } else {
147
+ output. truncate ( output_offset) ;
148
+ BrotliStreamResult :: ResultSuccess as i32
149
+ } ;
146
150
self . last_input_offset = 0 ;
147
151
Ok ( output. into_boxed_slice ( ) )
148
152
}
You can’t perform that action at this time.
0 commit comments