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

Unified Diff: core/fxcodec/jbig2/JBig2_TrdProc.cpp

Issue 2493633002: Add early returns in CJBig2_TRDProc::decode_Arith when decode fails. (Closed)
Patch Set: Woops Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/jbig2/JBig2_TrdProc.cpp
diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
index ccd8ebf98d273d19296792d86cc0ac2166e83a68..1329cde5f09840de2086d6875bbb316e323e1845 100644
--- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp
@@ -266,7 +266,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
std::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH));
SBREG->fill(SBDEFPIXEL);
int32_t STRIPT;
- pIADT->decode(pArithDecoder, &STRIPT);
+ if (!pIADT->decode(pArithDecoder, &STRIPT))
+ return nullptr;
STRIPT *= SBSTRIPS;
STRIPT = -STRIPT;
int32_t FIRSTS = 0;
@@ -274,7 +275,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
while (NINSTANCES < SBNUMINSTANCES) {
int32_t CURS = 0;
int32_t DT;
- pIADT->decode(pArithDecoder, &DT);
+ if (!pIADT->decode(pArithDecoder, &DT))
+ return nullptr;
DT *= SBSTRIPS;
STRIPT += DT;
bool bFirst = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698