Title: [264662] trunk
Revision
264662
Author
commit-qu...@webkit.org
Date
2020-07-21 10:37:50 -0700 (Tue, 21 Jul 2020)

Log Message

webgl/2.0.0/conformance2/state/gl-object-get-calls.html results appears to show an out of bounds access bug.
https://bugs.webkit.org/show_bug.cgi?id=214557

Patch by James Darpinian <jdarpin...@chromium.org> on 2020-07-21
Reviewed by Myles C. Maxfield.

The WebGL 2 function getActiveUniformBlockName was accidentally untested because an
unrelated bug caused the test to exit before reaching the part that tested it. The
other bug is fixed now, and this change fixes getActiveUniformBlockName to actually
work.

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
(WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):

Modified Paths

Diff

Modified: trunk/LayoutTests/platform/mac/TestExpectations (264661 => 264662)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-07-21 17:28:21 UTC (rev 264661)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-07-21 17:37:50 UTC (rev 264662)
@@ -143,7 +143,7 @@
 
 webkit.org/b/188061 [ Debug ] webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination.html [ Slow ]
 
-webkit.org/b/214557 webgl/2.0.0/conformance2/state/gl-object-get-calls.html [ Skip ]
+[ Debug ] webgl/2.0.0/conformance2/state/gl-object-get-calls.html [ Slow ]
 
 # Perf tests are very flaky, because they run in parallel with other tests.
 perf

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt (264661 => 264662)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt	2020-07-21 17:28:21 UTC (rev 264661)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt	2020-07-21 17:37:50 UTC (rev 264662)
@@ -339,20 +339,20 @@
 [ 336: PASS ] gl.getUniformBlockIndex(noUniformProgram, "u_normal") is gl.INVALID_INDEX
 [ 337: PASS ] gl.getProgramParameter(program, gl.LINK_STATUS) is true
 [ 338: PASS ] gl.getActiveUniformBlockName(program, 0) is "Transform"
-[ 339: FAIL ] gl.getActiveUniformBlockName(program, -1) should be null (of type object). Was (of type string).
+[ 339: PASS ] gl.getActiveUniformBlockName(program, -1) is null
 [ 340: PASS ] getError was expected value: INVALID_VALUE :
-[ 341: FAIL ] gl.getActiveUniformBlockName(program, 1) should be null (of type object). Was (of type string).
+[ 341: PASS ] gl.getActiveUniformBlockName(program, 1) is null
 [ 342: PASS ] getError was expected value: INVALID_VALUE :
-[ 343: FAIL ] gl.getActiveUniformBlockName(program, gl.INVALID_INDEX) should be null (of type object). Was (of type string).
+[ 343: PASS ] gl.getActiveUniformBlockName(program, gl.INVALID_INDEX) is null
 [ 344: PASS ] getError was expected value: INVALID_VALUE :
 [ 345: PASS ] gl.getProgramParameter(noLinkProgram, gl.LINK_STATUS) is false
-[ 346: FAIL ] getError expected: INVALID_OPERATION. Was INVALID_VALUE : after evaluating: gl.getActiveUniformBlockName(noLinkProgram, 0)
+[ 346: PASS ] getError was expected value: INVALID_OPERATION : after evaluating: gl.getActiveUniformBlockName(noLinkProgram, 0)
 [ 347: PASS ] gl.getProgramParameter(noUniformProgram, gl.LINK_STATUS) is true
-[ 348: FAIL ] gl.getActiveUniformBlockName(noUniformProgram, -1) should be null (of type object). Was (of type string).
+[ 348: PASS ] gl.getActiveUniformBlockName(noUniformProgram, -1) is null
 [ 349: PASS ] getError was expected value: INVALID_VALUE :
-[ 350: FAIL ] gl.getActiveUniformBlockName(noUniformProgram, 0) should be null (of type object). Was (of type string).
+[ 350: PASS ] gl.getActiveUniformBlockName(noUniformProgram, 0) is null
 [ 351: PASS ] getError was expected value: INVALID_VALUE :
-[ 352: FAIL ] gl.getActiveUniformBlockName(noUniformProgram, gl.INVALID_INDEX) should be null (of type object). Was (of type string).
+[ 352: PASS ] gl.getActiveUniformBlockName(noUniformProgram, gl.INVALID_INDEX) is null
 [ 353: PASS ] getError was expected value: INVALID_VALUE :
 [ 354: PASS ] gl.getProgramParameter(program, gl.LINK_STATUS) is true
 [ 355: PASS ] gl.getActiveUniformBlockParameter(program, 0, gl.UNIFORM_BLOCK_BINDING) is 0
@@ -364,5 +364,5 @@
 [ 361: PASS ] getActiveUniformBlockParameter correctly handled invalid pname enums
 [ 362: PASS ] getError was expected value: NO_ERROR :
 [ 363: PASS ] successfullyParsed is true
-[ FAIL ] 45 failures reported
+[ FAIL ] 38 failures reported
 

Modified: trunk/Source/WebCore/ChangeLog (264661 => 264662)


--- trunk/Source/WebCore/ChangeLog	2020-07-21 17:28:21 UTC (rev 264661)
+++ trunk/Source/WebCore/ChangeLog	2020-07-21 17:37:50 UTC (rev 264662)
@@ -1,3 +1,24 @@
+2020-07-21  James Darpinian  <jdarpin...@chromium.org>
+
+        webgl/2.0.0/conformance2/state/gl-object-get-calls.html results appears to show an out of bounds access bug.
+        https://bugs.webkit.org/show_bug.cgi?id=214557
+
+        Reviewed by Myles C. Maxfield.
+
+        The WebGL 2 function getActiveUniformBlockName was accidentally untested because an
+        unrelated bug caused the test to exit before reaching the part that tested it. The
+        other bug is fixed now, and this change fixes getActiveUniformBlockName to actually
+        work.
+
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
+        * platform/graphics/GraphicsContextGL.h:
+        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+        * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
+        (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
+
 2020-07-21  Sihui Liu  <sihui_...@appe.com>
 
         REGRESSION(r264486): ASSERTION FAILED: ASSERT_NOT_REACHED() in NetworkProcessPlatformStrategies::createBlobRegistry

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (264661 => 264662)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-07-21 17:28:21 UTC (rev 264661)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-07-21 17:37:50 UTC (rev 264662)
@@ -2526,7 +2526,14 @@
 #if USE(ANGLE)
     if (isContextLostOrPending() || !validateWebGLObject("getActiveUniformBlockName", &program))
         return String();
-    return m_context->getActiveUniformBlockName(program.object(), index);
+    if (!program.getLinkStatus()) {
+        synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "getActiveUniformBlockName", "program not linked");
+        return nullptr;
+    }
+    String name = m_context->getActiveUniformBlockName(program.object(), index);
+    if (name.isNull())
+        return nullptr;
+    return name;
 #else
     UNUSED_PARAM(program);
     UNUSED_PARAM(index);

Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (264661 => 264662)


--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-07-21 17:28:21 UTC (rev 264661)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2020-07-21 17:37:50 UTC (rev 264662)
@@ -1985,9 +1985,16 @@
     makeContextCurrent();
     GLint maxLength = 0;
     gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxLength);
+    if (maxLength <= 0) {
+        synthesizeGLError(INVALID_VALUE);
+        return String();
+    }
     Vector<GLchar> buffer(maxLength);
-    gl::GetActiveUniformBlockName(program, uniformBlockIndex, buffer.size(), nullptr, buffer.data());
-    return String(buffer.data());
+    GLsizei length = 0;
+    gl::GetActiveUniformBlockName(program, uniformBlockIndex, buffer.size(), &length, buffer.data());
+    if (!length)
+        return String();
+    return String(buffer.data(), length);
 }
 
 void GraphicsContextGLOpenGL::uniformBlockBinding(PlatformGLObject program, GCGLuint uniformBlockIndex, GCGLuint uniformBlockBinding)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to