summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp3
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 8bef264085..b195303800 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -220,7 +220,8 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) {
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString sFontName(syntax.GetWord());
- *sAlias = PDF_NameDecode(sFontName).Mid(1);
+ CFX_ByteString sDecodedFontName = PDF_NameDecode(sFontName);
+ *sAlias = sDecodedFontName.Mid(1, sDecodedFontName.GetLength() - 1);
CPDF_Dictionary* pFontDict = nullptr;
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP")) {
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;
}