diff options
author | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 12:42:17 +0000 |
---|---|---|
committer | wfh@chromium.org <wfh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-17 12:42:17 +0000 |
commit | fadbe9a68627dd442669d7f9e8026bb52bd75097 (patch) | |
tree | f6d3bf07edc8365b13839fb5ba5962c5795ca051 /ppapi | |
parent | b508687bd2b0f25d279d51c528d81747a69e003f (diff) | |
download | chromium_src-fadbe9a68627dd442669d7f9e8026bb52bd75097.zip chromium_src-fadbe9a68627dd442669d7f9e8026bb52bd75097.tar.gz chromium_src-fadbe9a68627dd442669d7f9e8026bb52bd75097.tar.bz2 |
Avoid referencing index [0] of a zero length string.
This is undefined behavior under c++03 and triggers iterator validators
when _ITERATOR_DEBUG_LEVEL > 0 which we hope to enable. See bug 289691
for all the gory details.
Tagging to the same bug as other asserts we've seen due to this issue.
BUG=132037
TEST=ppapi_unittests --gtest_filter=NaClHttpResponseHeadersTest.TestFindNoStore
Review URL: https://codereview.chromium.org/26973008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229108 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc b/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc index 16fa18f..ca35878 100644 --- a/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc +++ b/ppapi/native_client/src/trusted/plugin/nacl_http_response_headers.cc @@ -56,7 +56,7 @@ void NaClHttpResponseHeaders::Parse(const std::string& headers_str) { std::string key = tokens[0]; // Also ignore keys that start with white-space (they are invalid). // See: HttpResponseHeadersTest.NormalizeHeadersLeadingWhitespace. - if (key[0] == ' ' || key[0] == '\t') + if (key.length() == 0 || key[0] == ' ' || key[0] == '\t') continue; // TODO(jvoung): replace some of this with TrimWhitespaceASCII when // we move code to chromium. |