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

Unified Diff: gpu/blink/webgraphicscontext3d_impl.cc

Issue 978193003: Fix glGetActiveUniform/Attrib crashes due to state inconsistency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/blink/webgraphicscontext3d_impl.cc
diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc
index 581e10298ec45f87436452ae2fd3410e465e8eab..06185ffc373602c27c67df3abb08bc75658af622 100644
--- a/gpu/blink/webgraphicscontext3d_impl.cc
+++ b/gpu/blink/webgraphicscontext3d_impl.cc
@@ -361,11 +361,12 @@ bool WebGraphicsContext3DImpl::getActiveAttrib(
program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_name_length);
if (max_name_length < 0)
return false;
- scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
- if (!name) {
- synthesizeGLError(GL_OUT_OF_MEMORY);
Zhenyao Mo 2015/03/07 01:00:08 This is unnecessary because we always crash when "
+ if (max_name_length == 0) {
+ // No active attributes exist.
+ synthesizeGLError(GL_INVALID_VALUE);
no sievers 2015/03/09 19:10:08 This seems correct if the program is not valid. Bu
no sievers 2015/03/09 19:13:54 nm, we do call getProgramiv() but this is obviousl
Zhenyao Mo 2015/03/09 19:58:28 If the linked program has zero attribs or uniforms
return false;
}
+ scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
GLsizei length = 0;
GLint size = -1;
GLenum type = 0;
@@ -387,11 +388,12 @@ bool WebGraphicsContext3DImpl::getActiveUniform(
program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length);
if (max_name_length < 0)
return false;
- scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
- if (!name) {
- synthesizeGLError(GL_OUT_OF_MEMORY);
+ if (max_name_length == 0) {
+ // No active uniforms exist.
+ synthesizeGLError(GL_INVALID_VALUE);
return false;
}
+ scoped_ptr<GLchar[]> name(new GLchar[max_name_length]);
GLsizei length = 0;
GLint size = -1;
GLenum type = 0;
« 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