Chromium Code Reviews| Index: net/filter/brotli_source_stream.cc |
| diff --git a/net/filter/brotli_source_stream.cc b/net/filter/brotli_source_stream.cc |
| index a7f7283f6abeb3e04f7649747d931b5834f138fc..453ccac09e61e80e3314d302f0ccdedc8e1e3d03 100644 |
| --- a/net/filter/brotli_source_stream.cc |
| +++ b/net/filter/brotli_source_stream.cc |
| @@ -93,6 +93,14 @@ class BrotliSourceStream : public FilterSourceStream { |
| int input_buffer_size, |
| int* consumed_bytes, |
| bool /*upstream_eof_reached*/) override { |
| + if (decoding_status_ == DecodingStatus::DECODING_DONE) { |
| + *consumed_bytes = input_buffer_size; |
| + return OK; |
|
mmenke
2016/10/26 14:11:04
I think the test only covers one of these three ne
|
| + } |
| + |
| + if (decoding_status_ != DecodingStatus::DECODING_IN_PROGRESS) |
| + return ERR_CONTENT_DECODING_FAILED; |
|
xunjieli
2016/10/26 13:59:06
The original code has these two if-conditionals. I
|
| + |
| const uint8_t* next_in = bit_cast<uint8_t*>(input_buffer->data()); |
| size_t available_in = input_buffer_size; |
| uint8_t* next_out = bit_cast<uint8_t*>(output_buffer->data()); |
| @@ -125,6 +133,9 @@ class BrotliSourceStream : public FilterSourceStream { |
| return bytes_written; |
| case BROTLI_RESULT_SUCCESS: |
| decoding_status_ = DecodingStatus::DECODING_DONE; |
| + // Consume remaining bytes to avoid DCHECK in FilterSourceStream. |
| + // See crbug.com/659311. |
| + *consumed_bytes = input_buffer_size; |
| return bytes_written; |
| case BROTLI_RESULT_NEEDS_MORE_INPUT: |
| // Decompress needs more input has consumed all existing input. |