summaryrefslogtreecommitdiff
path: root/core/src/fxge/win32/fx_win32_device.cpp
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-07-14 12:13:53 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-07-14 12:13:53 -0700
commit8daab317ff959905e926b861a7d2aa876fd10429 (patch)
treed42dbefe9bbdf4492c537253fbc23abf21585fb5 /core/src/fxge/win32/fx_win32_device.cpp
parent456cde93a928629bbf2ac64bda13ef7923359823 (diff)
downloadpdfium-8daab317ff959905e926b861a7d2aa876fd10429.tar.xz
Fix an out-of-boundary issue for wide string
BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002
Diffstat (limited to 'core/src/fxge/win32/fx_win32_device.cpp')
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 2e2ea9a92b..9c03a30837 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -328,7 +328,9 @@ void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
for (int i = 0; i < iCount; ++i) {
if (face == VariantNames[i].m_pFaceName) {
CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf);
- CFX_WideString wsName = CFX_WideString::FromUTF16LE((const unsigned short*)VariantNames[i].m_pVariantName);
+ const unsigned short* pName = (const unsigned short*)VariantNames[i].m_pVariantName;
+ FX_STRSIZE len = CFX_WideString::WStringLength(pName);
+ CFX_WideString wsName = CFX_WideString::FromUTF16LE(pName, len);
if (wsFace == wsName) {
return hFont;
}