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

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

Issue 2158283002: deal with invalid readpixel format and type (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 | 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.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 670782ecb6243bb97252cfe4918b8eb3cc585274..8003a7b5f661308278a78dd3d485ff817f208802 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -5918,7 +5918,15 @@ bool GLES2DecoderImpl::GetHelper(
ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper",
GetErrorState());
glGetIntegerv(pname, params);
- if (glGetError() != GL_NO_ERROR) {
+ bool is_valid_format = true;
Zhenyao Mo 2016/07/19 16:42:38 You just need one is_valid, and you can initialize
+ bool is_valid_type = true;
+ if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) {
+ is_valid_format = validators_->read_pixel_format.IsValid(*params);
+ } else {
+ is_valid_type = validators_->read_pixel_type.IsValid(*params);
+ }
qiankun 2016/07/19 09:16:29 Maybe" ? : " is simpler than if-else. You just nee
+ if (glGetError() != GL_NO_ERROR || !is_valid_format ||
+ !is_valid_type) {
yunchao 2016/07/19 09:39:32 What it returns if the format/type is invalid?
if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) {
*params = GLES2Util::GetGLReadPixelsImplementationFormat(
GetBoundReadFrameBufferInternalFormat(),
« 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