| Index: xfa/fxfa/parser/xfa_basic_imp.cpp
|
| diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
|
| index 86a96bbd63db6e807ce8ee8c4a32090daa288402..f7c2606501bd526a159ef3a0942a0cb8dacd64e2 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();
|
|
|