From 8daab317ff959905e926b861a7d2aa876fd10429 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Mon, 14 Jul 2014 12:13:53 -0700 Subject: Fix an out-of-boundary issue for wide string BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002 --- core/src/fxge/win32/fx_win32_device.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/src/fxge') 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; } -- cgit v1.2.3