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

Unified Diff: xfa/fde/xml/fde_xml_imp.cpp

Issue 2223823003: Guard against undefined shift. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 4 years, 4 months 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 | xfa/fde/xml/fde_xml_imp_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/xml/fde_xml_imp.cpp
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index 4c6dcf989c4c910835c41ac17ea0adb58962ad9a..78cb6d80b2a3196d17ff267d9b9b36d24fb695c0 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -1868,14 +1868,22 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR ch) {
} else {
break;
}
+ if (ch < 0) {
Wei Li 2016/08/08 22:38:52 Should we check overflow instead of being negative
dsinclair 2016/08/09 00:21:51 I can switch to using overflow checking, will chan
dsinclair 2016/08/09 14:33:33 I tried the checked numeric but I'd also still nee
+ ch = ' ';
+ break;
+ }
}
} else {
for (int32_t i = 1; i < iLen; i++) {
w = csEntity[i];
- if (w < L'0' || w > L'9') {
+ if (w < L'0' || w > L'9')
break;
- }
ch = ch * 10 + w - L'0';
+
+ if (ch < 0) {
+ ch = ' ';
+ break;
+ }
}
}
if (ch != 0) {
« no previous file with comments | « no previous file | xfa/fde/xml/fde_xml_imp_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698