summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/PublicMethods.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript/PublicMethods.cpp')
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index bdae064cea..bf84b9cd91 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -983,7 +983,8 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime,
CFX_WideString wprefix = wstrValue.Mid(0, pEvent->SelStart());
CFX_WideString wpostfix;
if (pEvent->SelEnd() < wstrValue.GetLength())
- wpostfix = wstrValue.Mid(pEvent->SelEnd());
+ wpostfix = wstrValue.Mid(pEvent->SelEnd(),
+ wstrValue.GetLength() - pEvent->SelEnd());
val = wprefix + wstrChange + wpostfix;
return true;
}