| Index: gpu/command_buffer/service/program_manager.cc
|
| diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
|
| index f3c447cbd03c8c6075c65a67a366218f1268f6a7..1de61bbe8e4b65c1dd7dddaaa6d58c93fcffa689 100644
|
| --- a/gpu/command_buffer/service/program_manager.cc
|
| +++ b/gpu/command_buffer/service/program_manager.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/metrics/histogram.h"
|
| +#include "base/numerics/safe_math.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/time/time.h"
|
| @@ -66,7 +67,7 @@ bool GetUniformNameSansElement(
|
| return false;
|
| }
|
|
|
| - GLint index = 0;
|
| + base::CheckedNumeric<GLint> index = 0;
|
| size_t last = name.size() - 1;
|
| for (size_t pos = open_pos + 1; pos < last; ++pos) {
|
| int8 digit = name[pos] - '0';
|
| @@ -75,8 +76,11 @@ bool GetUniformNameSansElement(
|
| }
|
| index = index * 10 + digit;
|
| }
|
| + if (!index.IsValid()) {
|
| + return false;
|
| + }
|
|
|
| - *element_index = index;
|
| + *element_index = index.ValueOrDie();
|
| *new_name = name.substr(0, open_pos);
|
| return true;
|
| }
|
|
|