summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-12-01 10:36:44 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-01 10:36:44 -0800
commit9be9c3486688b84c723f41c85327abec238f15f9 (patch)
tree371d760fe93594355b54bcb547ca558dbba7ac2c
parent02759102cf998c9e937b3b65b64ed6b4c3b104bc (diff)
downloadpdfium-9be9c3486688b84c723f41c85327abec238f15f9.tar.xz
Improve early return in CGifLZWDecoder::Decode
|code_size_cur| could be larger than |code_size|, so |code| could be larger than |code_end|. If this happens, early return, since the Decode has failed. BUG=659417 Review-Url: https://codereview.chromium.org/2542673004
-rw-r--r--core/fxcodec/lgif/fx_gif.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp
index b996ba9796..b509c8ccfd 100644
--- a/core/fxcodec/lgif/fx_gif.cpp
+++ b/core/fxcodec/lgif/fx_gif.cpp
@@ -118,7 +118,7 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) {
if (code == code_clear) {
ClearTable();
continue;
- } else if (code == code_end) {
+ } else if (code >= code_end) {
des_size = i;
return 1;
} else {