From b43734a17cbd7b23bfda66d834f801c759135c1e Mon Sep 17 00:00:00 2001 From: "wfh@chromium.org" Date: Mon, 14 Oct 2013 21:24:24 +0000 Subject: Array index [0] on zero length array is undefined on C++03 and will assert when _ITERATOR_DEBUG_LEVEL is set to >= 1 on VS2010 Add protection against this code. This is the same underlying issue as 132037 so tagging to that bug BUG=132037 TEST=browser_tests --gtest_filter=OutOfProcessPPAPITest.* Review URL: https://codereview.chromium.org/26005003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228529 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/tests/test_char_set.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ppapi') diff --git a/ppapi/tests/test_char_set.cc b/ppapi/tests/test_char_set.cc index de998d0..f7ff910 100644 --- a/ppapi/tests/test_char_set.cc +++ b/ppapi/tests/test_char_set.cc @@ -113,7 +113,8 @@ std::string TestCharSet::TestUTF16ToCharSet() { std::vector utf16; utf16.push_back(0); std::string output_buffer; - uint32_t utf8result_len = static_cast(output_buffer.size()); + output_buffer.resize(1); + uint32_t utf8result_len = 0; PP_Bool result = char_set_trusted_interface_->UTF16ToCharSet( &utf16[0], 0, "latin1", PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE, &output_buffer[0], &utf8result_len); -- cgit v1.1