summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-27 20:52:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 20:52:58 +0000
commitccd9426e7127373c13986fd4f8a029f744e9dad0 (patch)
tree5a62f20bfbd0aabc1550950b040ae94c3ad6e8e9 /core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
parent74136f59eaebb98a4dcc23777203d907d9555c1a (diff)
downloadpdfium-ccd9426e7127373c13986fd4f8a029f744e9dad0.tar.xz
Adjust CJBig2_Context::HuffmanAssignCode().
It looks a lot like CJBig2_HuffmanTable::InitCodes(). Port over the UBSAN error fix from commit 76c9a1b1. BUG=chromium:709781 Change-Id: I5d2f8fb013c09099c82b0565627b77e4fb0f8a98 Reviewed-on: https://pdfium-review.googlesource.com/31536 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_HuffmanTable.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_HuffmanTable.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index 83f9fed010..5a49e1e4be 100644
--- a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
+++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
@@ -122,8 +122,8 @@ bool CJBig2_HuffmanTable::InitCodes() {
FIRSTCODE[0] = 0;
LENCOUNT[0] = 0;
for (int i = 1; i <= lenmax; ++i) {
- pdfium::base::CheckedNumeric<int> shifted;
- shifted = FIRSTCODE[i - 1] + LENCOUNT[i - 1];
+ pdfium::base::CheckedNumeric<int> shifted = FIRSTCODE[i - 1];
+ shifted += LENCOUNT[i - 1];
shifted <<= 1;
if (!shifted.IsValid())
return false;