diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 04:51:05 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 04:51:05 +0000 |
commit | 349a9a34325fbbb74031803f4e37e321fa621e0e (patch) | |
tree | b1545a7194a698ef329802cdf9ce48b8f8f1ccc0 | |
parent | d8c04fed207ba8a4edd06c78d809b6d56da3e95b (diff) | |
download | chromium_src-349a9a34325fbbb74031803f4e37e321fa621e0e.zip chromium_src-349a9a34325fbbb74031803f4e37e321fa621e0e.tar.gz chromium_src-349a9a34325fbbb74031803f4e37e321fa621e0e.tar.bz2 |
Fixes the issues with Jump, JumpRel, Call, CallRel
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/614006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39192 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | gpu/command_buffer/service/cmd_parser.h | 2 | ||||
-rw-r--r-- | gpu/command_buffer/service/cmd_parser_test.cc | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/cmd_parser.h b/gpu/command_buffer/service/cmd_parser.h index c971c62..663ea48 100644 --- a/gpu/command_buffer/service/cmd_parser.h +++ b/gpu/command_buffer/service/cmd_parser.h @@ -32,7 +32,7 @@ class CommandParser { // Sets the "get" pointer. The get pointer is an index into the command buffer // considered as an array of CommandBufferEntry. bool set_get(CommandBufferOffset get) { - if (get < entry_count_) { + if (get >= 0 && get < entry_count_) { get_ = get; return true; } diff --git a/gpu/command_buffer/service/cmd_parser_test.cc b/gpu/command_buffer/service/cmd_parser_test.cc index cacff99..d46cf3b 100644 --- a/gpu/command_buffer/service/cmd_parser_test.cc +++ b/gpu/command_buffer/service/cmd_parser_test.cc @@ -225,10 +225,14 @@ TEST_F(CommandParserTest, TestWrap) { // Tests error conditions. TEST_F(CommandParserTest, TestError) { - scoped_ptr<CommandParser> parser(MakeParser(5)); + const unsigned int kNumEntries = 5; + scoped_ptr<CommandParser> parser(MakeParser(kNumEntries)); CommandBufferOffset put = parser->put(); CommandHeader header; + EXPECT_FALSE(parser->set_get(-1)); + EXPECT_FALSE(parser->set_get(kNumEntries)); + // Generate a command with size 0. header.size = 0; header.command = 3; |