summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_widestring_unittest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-22 12:26:57 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-22 20:25:38 +0000
commited75ee25f40a475f774e1e06c5375feee70b56f5 (patch)
treecc8ebb92de480789e951047fde87b021f68d2da1 /core/fxcrt/cfx_widestring_unittest.cpp
parent671630e52cda1abb5b1da71f366211cc3c95482f (diff)
downloadpdfium-ed75ee25f40a475f774e1e06c5375feee70b56f5.tar.xz
CFX_ByteStringC: avoid taking unreferenceable vector::data() ptr.chromium/3108
Otherwise, the UnownedPtr destructor will try to probe it. ASAN knows about the structure of std::vector and will flag it as such. Bug: 724960 Change-Id: I2b24501704c3845a4b16edad191d7b8f41f77587 Reviewed-on: https://pdfium-review.googlesource.com/5750 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_widestring_unittest.cpp')
-rw-r--r--core/fxcrt/cfx_widestring_unittest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/cfx_widestring_unittest.cpp
index a9cb2d34cd..f5a0e12560 100644
--- a/core/fxcrt/cfx_widestring_unittest.cpp
+++ b/core/fxcrt/cfx_widestring_unittest.cpp
@@ -702,6 +702,13 @@ TEST(fxcrt, WideStringCFromVector) {
CFX_WideStringC lower_a_string(lower_a_vec);
EXPECT_EQ(10, lower_a_string.GetLength());
EXPECT_EQ(L"aaaaaaaaaa", lower_a_string);
+
+ std::vector<CFX_WideStringC::UnsignedType> cleared_vec;
+ cleared_vec.push_back(42);
+ cleared_vec.pop_back();
+ CFX_WideStringC cleared_string(cleared_vec);
+ EXPECT_EQ(0, cleared_string.GetLength());
+ EXPECT_EQ(nullptr, cleared_string.raw_str());
}
TEST(fxcrt, WideStringCOperatorSubscript) {