| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index aa3b18d4e783c28b8bb69de4ca9198c64856346c..9ef7f09c688460376722547516841728526fc8e7 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -19,6 +19,7 @@
|
| #include <string>
|
| #include "base/atomic_sequence_num.h"
|
| #include "base/compiler_specific.h"
|
| +#include "base/numerics/safe_math.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/sys_info.h"
|
| @@ -2875,6 +2876,18 @@ void GLES2Implementation::TexSubImage2D(
|
| pixels = reinterpret_cast<const int8_t*>(pixels) + skip_size;
|
|
|
| ScopedTransferBufferPtr buffer(size, helper_, transfer_buffer_);
|
| + base::CheckedNumeric<GLint> checked_xoffset = xoffset;
|
| + checked_xoffset += width;
|
| + if (!checked_xoffset.IsValid()) {
|
| + SetGLError(GL_INVALID_VALUE, "TexSubImage2D", "xoffset + width overflows");
|
| + return;
|
| + }
|
| + base::CheckedNumeric<GLint> checked_yoffset = yoffset;
|
| + checked_yoffset += height;
|
| + if (!checked_yoffset.IsValid()) {
|
| + SetGLError(GL_INVALID_VALUE, "TexSubImage2D", "yoffset + height overflows");
|
| + return;
|
| + }
|
| TexSubImage2DImpl(
|
| target, level, xoffset, yoffset, width, height, format, type,
|
| unpadded_row_size, pixels, padded_row_size, GL_FALSE, &buffer,
|
| @@ -3000,6 +3013,24 @@ void GLES2Implementation::TexSubImage3D(
|
| pixels = reinterpret_cast<const int8_t*>(pixels) + skip_size;
|
|
|
| ScopedTransferBufferPtr buffer(size, helper_, transfer_buffer_);
|
| + base::CheckedNumeric<GLint> checked_xoffset = xoffset;
|
| + checked_xoffset += width;
|
| + if (!checked_xoffset.IsValid()) {
|
| + SetGLError(GL_INVALID_VALUE, "TexSubImage3D", "xoffset + width overflows");
|
| + return;
|
| + }
|
| + base::CheckedNumeric<GLint> checked_yoffset = yoffset;
|
| + checked_yoffset += height;
|
| + if (!checked_yoffset.IsValid()) {
|
| + SetGLError(GL_INVALID_VALUE, "TexSubImage3D", "yoffset + height overflows");
|
| + return;
|
| + }
|
| + base::CheckedNumeric<GLint> checked_zoffset = zoffset;
|
| + checked_zoffset += depth;
|
| + if (!checked_zoffset.IsValid()) {
|
| + SetGLError(GL_INVALID_VALUE, "TexSubImage3D", "zoffset + depth overflows");
|
| + return;
|
| + }
|
| TexSubImage3DImpl(
|
| target, level, xoffset, yoffset, zoffset, width, height, depth,
|
| format, type, unpadded_row_size, pixels, padded_row_size, GL_FALSE,
|
|
|