diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:20:11 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:20:11 +0000 |
commit | 3d79804c583eef9a0bc8bff30d41ca5a19ef1bc4 (patch) | |
tree | 1f68e544f021c4f0ee6063f2a92050142b344af0 /gpu | |
parent | 75b841290867be611cb33719fbe267b0b2f9b362 (diff) | |
download | chromium_src-3d79804c583eef9a0bc8bff30d41ca5a19ef1bc4.zip chromium_src-3d79804c583eef9a0bc8bff30d41ca5a19ef1bc4.tar.gz chromium_src-3d79804c583eef9a0bc8bff30d41ca5a19ef1bc4.tar.bz2 |
Coverity: Fix gpu::gles2::GetCommandName range check.
CID=7802
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2813056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/common/gles2_cmd_format.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_format.cc b/gpu/command_buffer/common/gles2_cmd_format.cc index 8151d8b..fabdf79 100644 --- a/gpu/command_buffer/common/gles2_cmd_format.cc +++ b/gpu/command_buffer/common/gles2_cmd_format.cc @@ -23,12 +23,9 @@ const char* GetCommandName(CommandId id) { #undef GLES2_CMD_OP }; - int index = static_cast<int>(id) - kStartPoint - 1; - return (index >= 0 && index < kNumCommands) ? - names[index] : "*unknown-command*"; + size_t index = static_cast<size_t>(id) - kStartPoint - 1; + return (index < arraysize(names)) ? names[index] : "*unknown-command*"; } } // namespace gles2 } // namespace gpu - - |