summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-01 08:13:55 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-01 08:13:55 +0000
commit0ac36018b464f74419b8b8e77d9452b41440187a (patch)
treefb081fc3457c5c2c2e141613ddcbf6415a5761ae /xfa
parent53d4f0a4526ef996caf5005ae84406a9467423f2 (diff)
downloadpdfium-0ac36018b464f74419b8b8e77d9452b41440187a.tar.xz
Fix a nullptr crash in CXFA_LocaleValue::ValidateValue().
Fix some nits as well. BUG=chromium:868271 Change-Id: Ia3231fde98c3e16e41b092a9833402cedc8e828d Reviewed-on: https://pdfium-review.googlesource.com/39112 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 15082ae5e3..c201f88ef2 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -99,6 +99,9 @@ bool CXFA_LocaleValue::ValidateValue(const WideString& wsValue,
const WideString& wsPattern,
LocaleIface* pLocale,
WideString* pMatchFormat) {
+ if (!m_pLocaleMgr)
+ return false;
+
WideString wsOutput;
LocaleIface* locale = m_pLocaleMgr->GetDefLocale();
if (pLocale)
@@ -109,10 +112,9 @@ bool CXFA_LocaleValue::ValidateValue(const WideString& wsValue,
pFormat->SplitFormatString(wsPattern, &wsPatterns);
bool bRet = false;
- int32_t iCount = pdfium::CollectionSize<int32_t>(wsPatterns);
- int32_t i = 0;
- for (; i < iCount && !bRet; i++) {
- WideString wsFormat = wsPatterns[i];
+ size_t i = 0;
+ for (; !bRet && i < wsPatterns.size(); i++) {
+ const WideString& wsFormat = wsPatterns[i];
switch (ValueCategory(pFormat->GetCategory(wsFormat), m_dwType)) {
case FX_LOCALECATEGORY_Null:
bRet = pFormat->ParseNull(wsValue, wsFormat);