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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2690633003: Add validation to gl[Bind|Release]TexImage2DCHROMIUM. (Closed)
Patch Set: Created 3 years, 10 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/service/gles2_cmd_decoder_passthrough_doers.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
index db92cb4dda07bee3497fdbda38c24f1fed4cc801..b576c45ab20b4afef6ad5c438ea28af8a7b94047 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
@@ -2901,19 +2901,38 @@ error::Error GLES2DecoderPassthroughImpl::DoBindUniformLocationCHROMIUM(
error::Error GLES2DecoderPassthroughImpl::DoBindTexImage2DCHROMIUM(
GLenum target,
GLint imageId) {
- // TODO(geofflang): error handling
+ if (target != GL_TEXTURE_2D) {
+ InsertError(GL_INVALID_ENUM, "Invalid target");
+ return error::kNoError;
+ }
+
gl::GLImage* image = image_manager_->LookupImage(imageId);
+ if (image == nullptr) {
+ InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
+ return error::kNoError;
+ }
+
if (!image->BindTexImage(target)) {
image->CopyTexImage(target);
}
+
return error::kNoError;
}
error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM(
GLenum target,
GLint imageId) {
- // TODO(geofflang): error handling
+ if (target != GL_TEXTURE_2D) {
+ InsertError(GL_INVALID_ENUM, "Invalid target");
+ return error::kNoError;
+ }
+
gl::GLImage* image = image_manager_->LookupImage(imageId);
+ if (image == nullptr) {
+ InsertError(GL_INVALID_OPERATION, "No image found with the given ID");
+ return error::kNoError;
+ }
+
image->ReleaseTexImage(target);
return error::kNoError;
}
« 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