From 0b36bb48bd2e8c0a24505521e267cdd52a1dd683 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 1 May 2015 16:12:48 -0700 Subject: Merge to XFA: CFX_ByteString/WideString header changes Original Review URL: https://codereview.chromium.org/1117413002 Original Review URL: https://codereview.chromium.org/1118983003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1125493002 --- core/src/fxcrt/fx_basic_wstring.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/src/fxcrt/fx_basic_wstring.cpp') diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp index 42a7ad72a6..742f249e37 100644 --- a/core/src/fxcrt/fx_basic_wstring.cpp +++ b/core/src/fxcrt/fx_basic_wstring.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include // For offsetof(). + #include "../../include/fxcrt/fx_basic.h" #include "../../../third_party/base/numerics/safe_math.h" @@ -15,7 +17,8 @@ static CFX_StringDataW* FX_AllocStringW(int nLen) return NULL; } - int overhead = 3 * sizeof(long) + sizeof(FX_WCHAR); // +WCHAR is for NUL. + // Fixed portion of header plus a NUL wide char not in m_nAllocLength. + int overhead = offsetof(CFX_StringDataW, m_String) + sizeof(FX_WCHAR); pdfium::base::CheckedNumeric iSize = nLen; iSize *= sizeof(FX_WCHAR); iSize += overhead; -- cgit v1.2.3