summaryrefslogtreecommitdiffstats
path: root/third_party/brotli
diff options
context:
space:
mode:
authoreustas <eustas@chromium.org>2016-02-04 19:17:46 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-05 03:18:25 +0000
commit7716418a27d561ee295a99f11fd3865580748de2 (patch)
treea67eabcd215cc12094bbe28c74e0677464a70a30 /third_party/brotli
parent39018a42a10754d64b929402f3e2a9dd740a0677 (diff)
downloadchromium_src-7716418a27d561ee295a99f11fd3865580748de2.zip
chromium_src-7716418a27d561ee295a99f11fd3865580748de2.tar.gz
chromium_src-7716418a27d561ee295a99f11fd3865580748de2.tar.bz2
Cherry pick underflow fix.
BUG=583607 Review URL: https://codereview.chromium.org/1662313002 Cr-Commit-Position: refs/heads/master@{#373736}
Diffstat (limited to 'third_party/brotli')
-rw-r--r--third_party/brotli/README.chromium1
-rw-r--r--third_party/brotli/dec/decode.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/third_party/brotli/README.chromium b/third_party/brotli/README.chromium
index 813e758..ae764cf 100644
--- a/third_party/brotli/README.chromium
+++ b/third_party/brotli/README.chromium
@@ -16,3 +16,4 @@ Local Modifications:
- .gitignore: Added.
- BUILD.gn: Added.
- brotli.gyp: Added.
+- Cherry-picked 37a320dd81db8d546cd24a45b4c61d87b45dcade (04 Feb 2016) \ No newline at end of file
diff --git a/third_party/brotli/dec/decode.c b/third_party/brotli/dec/decode.c
index 5d4af1d..6326c20 100644
--- a/third_party/brotli/dec/decode.c
+++ b/third_party/brotli/dec/decode.c
@@ -1700,6 +1700,10 @@ postReadDistance:
uint8_t* copy_src = &s->ringbuffer[
(pos - s->distance_code) & s->ringbuffer_mask];
uint8_t* copy_dst = &s->ringbuffer[pos];
+ /* Check for possible underflow and clamp the pointer to 0. */
+ if (PREDICT_FALSE(s->ringbuffer_end < (const uint8_t*)0 + i)) {
+ ringbuffer_end_minus_copy_length = 0;
+ }
/* update the recent distances cache */
s->dist_rb[s->dist_rb_idx & 3] = s->distance_code;
++s->dist_rb_idx;