diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 22:10:14 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-01 22:10:14 +0000 |
commit | 1753e751f0d9130777b594189a3ad70ef372454f (patch) | |
tree | 2c555c6c1906abc815efc87b1460b2b15034252b /gpu | |
parent | 71a88bba9333bf52789e212151f8780136ad13ff (diff) | |
download | chromium_src-1753e751f0d9130777b594189a3ad70ef372454f.zip chromium_src-1753e751f0d9130777b594189a3ad70ef372454f.tar.gz chromium_src-1753e751f0d9130777b594189a3ad70ef372454f.tar.bz2 |
Fix an assertion in debug mode in shader log processing.
The bug is caused by sizeof counting in '\0'.
BUG=173723
TEST=gpu mac debug bots
Review URL: https://codereview.chromium.org/12163008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180195 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/program_manager.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 4bbc933..c179ac8 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -152,6 +152,7 @@ void ProgramManager::ProgramInfo::Reset() { std::string ProgramManager::ProgramInfo::ProcessLogInfo( const std::string& log) { const char kHashedNamePrefix[] = "webgl_"; + const size_t kHashedNamePrefixLength = sizeof(kHashedNamePrefix) - 1; std::string output; size_t current = 0; @@ -160,10 +161,10 @@ std::string ProgramManager::ProgramInfo::ProcessLogInfo( output += log.substr(current, next - current); size_t end_of_name = log.find_first_not_of( - "0123456789abcdefABCDEF", next + sizeof(kHashedNamePrefix)); + "0123456789abcdefABCDEF", next + kHashedNamePrefixLength); size_t name_length = end_of_name - next; // Currently we use 64bit hashing, which converts to 16 hex digits. - DCHECK(name_length == sizeof(kHashedNamePrefix) + 16); + DCHECK(name_length == kHashedNamePrefixLength + 16); std::string hashed_name = log.substr(next, name_length); const std::string* original_name = GetOriginalNameFromHashedName(hashed_name); @@ -173,7 +174,7 @@ std::string ProgramManager::ProgramInfo::ProcessLogInfo( } else { // This shouldn't happen, but still handle it, to be on the safer side. output += std::string(kHashedNamePrefix); - current += sizeof(kHashedNamePrefix); + current += kHashedNamePrefixLength; } next = log.find(kHashedNamePrefix, current); } |