summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 02:18:54 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 02:18:54 +0000
commit45861e6dc240638f5bebf84fcf75f28493986017 (patch)
tree95d0fa1084f1346c5a6d99dafd53e2fbc0560cda /gpu
parenta1eaf4d37a7455911fa87269075aaa7e7db6c67e (diff)
downloadchromium_src-45861e6dc240638f5bebf84fcf75f28493986017.zip
chromium_src-45861e6dc240638f5bebf84fcf75f28493986017.tar.gz
chromium_src-45861e6dc240638f5bebf84fcf75f28493986017.tar.bz2
Fix gles2_cmd_format overflow
BUG=171200 Review URL: https://chromiumcodereview.appspot.com/12040004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_format.h b/gpu/command_buffer/common/gles2_cmd_format.h
index 93d7a6f..bf60a73 100644
--- a/gpu/command_buffer/common/gles2_cmd_format.h
+++ b/gpu/command_buffer/common/gles2_cmd_format.h
@@ -12,6 +12,7 @@
#include <string.h>
+#include "base/safe_numerics.h"
#include "../common/types.h"
#include "../common/bitfield_helpers.h"
#include "../common/cmd_buffer_common.h"
@@ -248,11 +249,12 @@ struct GetAttribLocationImmediate {
typedef GLint Result;
static uint32 ComputeDataSize(const char* s) {
- return strlen(s);
+ return base::checked_numeric_cast<uint32>(strlen(s));
}
static uint32 ComputeSize(const char* s) {
- return static_cast<uint32>(sizeof(ValueType) + ComputeDataSize(s));
+ return base::checked_numeric_cast<uint32>(sizeof(ValueType) +
+ ComputeDataSize(s));
}
void SetHeader(const char* s) {
@@ -428,11 +430,12 @@ struct GetUniformLocationImmediate {
typedef GLint Result;
static uint32 ComputeDataSize(const char* s) {
- return strlen(s);
+ return base::checked_numeric_cast<uint32>(strlen(s));
}
static uint32 ComputeSize(const char* s) {
- return static_cast<uint32>(sizeof(ValueType) + ComputeDataSize(s));
+ return base::checked_numeric_cast<uint32>(sizeof(ValueType) +
+ ComputeDataSize(s));
}
void SetHeader(const char* s) {