Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1670)

Unified Diff: third_party/brotli/enc/encode.cc

Issue 1995193003: Update brotli 11 May 2016 (4cc756) -> 20 May 2016 (4836af) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/brotli/enc/encode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « third_party/brotli/enc/encode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698