summaryrefslogtreecommitdiffstats
path: root/modules/brotli/enc/ringbuffer.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
commit5165ed02285315cc0bed7977c7bac6d0a90ca43c (patch)
tree9b761a21eb924915e51c2d803208e6c01b505a45 /modules/brotli/enc/ringbuffer.h
parente1db27e19989db11fef70f439cf95821316535b3 (diff)
parentca9abcdf1702c37bf00048dab3f460b2252873a3 (diff)
downloadUXP-RELBASE_20201124.tar
UXP-RELBASE_20201124.tar.gz
UXP-RELBASE_20201124.tar.lz
UXP-RELBASE_20201124.tar.xz
UXP-RELBASE_20201124.zip
Merge branch 'redwood' into releaseRELBASE_20201124RELBASE_20201120RC_20201120
Diffstat (limited to 'modules/brotli/enc/ringbuffer.h')
-rw-r--r--modules/brotli/enc/ringbuffer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/brotli/enc/ringbuffer.h b/modules/brotli/enc/ringbuffer.h
index 86079a89d..8dce14803 100644
--- a/modules/brotli/enc/ringbuffer.h
+++ b/modules/brotli/enc/ringbuffer.h
@@ -75,7 +75,7 @@ static BROTLI_INLINE void RingBufferInitBuffer(
uint8_t* new_data = BROTLI_ALLOC(
m, uint8_t, 2 + buflen + kSlackForEightByteHashingEverywhere);
size_t i;
- if (BROTLI_IS_OOM(m)) return;
+ if (BROTLI_IS_OOM(m) || BROTLI_IS_NULL(new_data)) return;
if (rb->data_) {
memcpy(new_data, rb->data_,
2 + rb->cur_size_ + kSlackForEightByteHashingEverywhere);
@@ -125,6 +125,9 @@ static BROTLI_INLINE void RingBufferWrite(
later when we copy the last two bytes to the first two positions. */
rb->buffer_[rb->size_ - 2] = 0;
rb->buffer_[rb->size_ - 1] = 0;
+ /* Initialize tail; might be touched by "best_len++" optimization when
+ ring buffer is "full". */
+ rb->buffer_[rb->size_] = 241;
}
{
const size_t masked_pos = rb->pos_ & rb->mask_;