diff options
author | Jun Fang <jun_fang@foxitsoftware.com> | 2015-11-25 11:13:50 +0800 |
---|---|---|
committer | Jun Fang <jun_fang@foxitsoftware.com> | 2015-11-25 11:13:50 +0800 |
commit | c70b19aad245fb1ed39bf8c264d991555f4c5a58 (patch) | |
tree | 5a86d91e65962343aba109e46ed58c9d9b999933 /core/src/fxcrt/fx_basic_buffer.cpp | |
parent | 01fe5885b4dfbd9f116fb62b7bce585c153bfa77 (diff) | |
download | pdfium-c70b19aad245fb1ed39bf8c264d991555f4c5a58.tar.xz |
Fix invalid buffer length set in CFX_WideString::UTF16LE_Encode()
BUG=pdfium:275
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1443603002 .
Diffstat (limited to 'core/src/fxcrt/fx_basic_buffer.cpp')
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index f606f1d368..1178331283 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -318,8 +318,9 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_ByteString& str) { CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) { CFX_ByteString encoded; operator>>(encoded); - str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), - encoded.GetLength()); + str = CFX_WideString::FromUTF16LE( + reinterpret_cast<const unsigned short*>(encoded.c_str()), + encoded.GetLength() / sizeof(unsigned short)); return *this; } FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { |