| Index: third_party/brotli/enc/encode.cc
|
| diff --git a/third_party/brotli/enc/encode.cc b/third_party/brotli/enc/encode.cc
|
| index 3e1c79ad56cd7c67ba417ede84b728820ebbbcfd..8b019a6f96209606cc553dfc0735883ec8506de2 100644
|
| --- a/third_party/brotli/enc/encode.cc
|
| +++ b/third_party/brotli/enc/encode.cc
|
| @@ -442,7 +442,8 @@ BrotliCompressor::BrotliCompressor(BrotliParams params)
|
| large_table_(NULL),
|
| cmd_code_numbits_(0),
|
| command_buf_(NULL),
|
| - literal_buf_(NULL) {
|
| + literal_buf_(NULL),
|
| + is_last_block_emitted_(0) {
|
| // Sanitize params.
|
| params_.quality = std::max(0, params_.quality);
|
| if (params_.lgwin < kMinWindowBits) {
|
| @@ -583,6 +584,10 @@ bool BrotliCompressor::WriteBrotliData(const bool is_last,
|
| const uint8_t* data = ringbuffer_->start();
|
| const uint32_t mask = ringbuffer_->mask();
|
|
|
| + /* Adding more blocks after "last" block is forbidden. */
|
| + if (is_last_block_emitted_) return false;
|
| + if (is_last) is_last_block_emitted_ = 1;
|
| +
|
| if (delta > input_block_size()) {
|
| return false;
|
| }
|
|
|