Commit 9f394f8c by Olli Etuaho Committed by Commit Bot

Fix use-after-free in drawQuad with useVertexBuffer false

quadVertices.data() pointer needs to remain valid until drawArrays is called. To guarantee that quadVertices should stay in the stack until the end of drawQuad(). BUG=angleproject:2533 TEST=angle_end2end_tests Change-Id: I263262db9a9ed9c9cd0d8679addd09677ad7179e Reviewed-on: https://chromium-review.googlesource.com/1046600 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent fad918f8
...@@ -464,6 +464,8 @@ void ANGLETestBase::drawQuad(GLuint program, ...@@ -464,6 +464,8 @@ void ANGLETestBase::drawQuad(GLuint program,
GLint positionLocation = glGetAttribLocation(program, positionAttribName.c_str()); GLint positionLocation = glGetAttribLocation(program, positionAttribName.c_str());
std::array<angle::Vector3, 6> quadVertices;
if (useVertexBuffer) if (useVertexBuffer)
{ {
setupQuadVertexBuffer(positionAttribZ, positionAttribXYScale); setupQuadVertexBuffer(positionAttribZ, positionAttribXYScale);
...@@ -472,7 +474,7 @@ void ANGLETestBase::drawQuad(GLuint program, ...@@ -472,7 +474,7 @@ void ANGLETestBase::drawQuad(GLuint program,
} }
else else
{ {
auto quadVertices = GetQuadVertices(); quadVertices = GetQuadVertices();
for (angle::Vector3 &vertex : quadVertices) for (angle::Vector3 &vertex : quadVertices)
{ {
vertex.x() *= positionAttribXYScale; vertex.x() *= positionAttribXYScale;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment