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

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

Issue 2177513002: gpu: Avoid integer overflow when setting up client side buffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | gpu/command_buffer/client/vertex_array_object_manager.h » ('j') | 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 dbd7fffc60c7037a690a2eb58fa1befa7dc3d720..5e279e74f36b301122fb36351d956d83a5997296 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -4563,9 +4563,13 @@ void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) {
return;
}
bool simulated = false;
- if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers(
- "glDrawArrays", this, helper_, first + count, 0, &simulated)) {
- return;
+ if (vertex_array_object_manager_->SupportsClientSideBuffers()) {
+ GLsizei num_elements;
+ SafeAddInt32(first, count, &num_elements);
Zhenyao Mo 2016/08/04 17:40:14 We should generate INVALID_VALUE if SafeAddInt32 r
+ if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers(
+ "glDrawArrays", this, helper_, num_elements, 0, &simulated)) {
+ return;
+ }
}
helper_->DrawArrays(mode, first, count);
RestoreArrayBuffer(simulated);
@@ -5576,10 +5580,14 @@ void GLES2Implementation::DrawArraysInstancedANGLE(
return;
}
bool simulated = false;
- if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers(
- "glDrawArraysInstancedANGLE", this, helper_, first + count, primcount,
- &simulated)) {
- return;
+ if (vertex_array_object_manager_->SupportsClientSideBuffers()) {
+ GLsizei num_elements;
+ SafeAddInt32(first, count, &num_elements);
Zhenyao Mo 2016/08/04 17:40:14 Same here.
+ if (!vertex_array_object_manager_->SetupSimulatedClientSideBuffers(
+ "glDrawArraysInstancedANGLE", this, helper_, num_elements,
+ primcount, &simulated)) {
+ return;
+ }
}
helper_->DrawArraysInstancedANGLE(mode, first, count, primcount);
RestoreArrayBuffer(simulated);
« no previous file with comments | « no previous file | gpu/command_buffer/client/vertex_array_object_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698