Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1187)

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2310243002: Supress integer-overflow in TexSubImage2D(3D)Impl (Closed)
Patch Set: clean up Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4a879f41ee9d76a524ef60fd18129083d55922da 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"
@@ -3066,7 +3067,9 @@ void GLES2Implementation::TexSubImage2DImpl(GLenum target,
target, level, xoffset, yoffset, width, num_rows, format, type,
buffer->shm_id(), buffer->offset(), internal);
buffer->Release();
- yoffset += num_rows;
+ base::CheckedNumeric<GLint> updated_yoffset = yoffset;
+ updated_yoffset += num_rows;
+ yoffset = updated_yoffset.ValueOrDefault(std::numeric_limits<int>::max());
Zhenyao Mo 2016/09/07 02:15:16 Can we generate an INVALID_VALUE instead?
xidachen 2016/09/07 12:23:00 I used GL_INVALID_VALUE. So do we have checks some
source += num_rows * pixels_padded_row_size;
height -= num_rows;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698