summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-14 07:34:20 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-14 07:34:20 -0700
commit756d37943415ca15d491b79ba78012225a06db76 (patch)
tree817ecb7fc2a84e7562006931ff97ad46858fe4d3 /xfa
parentfc6326d6cd51878c8ec3b8b51767dce368d07f67 (diff)
downloadpdfium-756d37943415ca15d491b79ba78012225a06db76.tar.xz
Add fuzzer for FDE CSS syntax parser.
This CL adds a fuzzer for the CSS Syntax parser in XFA. BUG=chromium:587126 Review-Url: https://codereview.chromium.org/2068513002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/parser/xfa_basic_imp.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index 86a96bbd63..f7c2606501 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -557,9 +557,10 @@ int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr,
int32_t iMaxLength,
FX_BOOL& bEOS,
int32_t const* pByteSize) {
- if (iMaxLength > m_wsBuffer.GetLength() - m_iPosition) {
- iMaxLength = m_wsBuffer.GetLength() - m_iPosition;
- }
+ iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition);
+ if (iMaxLength == 0)
+ return 0;
+
FXSYS_wcsncpy(pStr, m_wsBuffer.c_str() + m_iPosition, iMaxLength);
m_iPosition += iMaxLength;
bEOS = IsEOF();