OSDN Git Service

Early exit in es2::Context::drawElements on count=0.
authorCody Schuffelen <schuffelen@google.com>
Thu, 7 Feb 2019 22:31:59 +0000 (14:31 -0800)
committerCody Schuffelen <schuffelen@google.com>
Fri, 8 Feb 2019 22:35:23 +0000 (22:35 +0000)
commit9686153413f37c9150e511ee19b6e3fb94d7c98f
treecc95db2e68c604ee62fc6d6e39eba94824d0ba2c
parent7fb0b73b1aa74b33c08258cef1fe800dc8a94e26
Early exit in es2::Context::drawElements on count=0.

This fixes an issue where es2::Context::drawElements would still try to
read draw data even when there are 0 elements to draw, causing a buffer
overflow on draw data.

This was found by running Android ES3 dEQP under ASAN. The failing tests
are EQP-GLES3.functional.primitive_restart.[begin_restart,
begin_restart_duplicate_restarts, begin_restart_end_restart,
begin_restart_end_restart_duplicate_restarts,
end_restart_duplicate_restarts, duplicate_restarts].*

The crashing dEQP tests cover glDrawElementsInstanced,
glDrawRangeElements, and glDrawElements. These all converge onto
es2::Context::drawElements.

Bug: b/123716871
Change-Id: I4bca0616eb9f92bf18a3331459f3dcd06b8ac9a9
Signed-off-by: Cody Schuffelen <schuffelen@google.com>
Test: cts-tradefed run commandAndExit cts -m CtsDeqpTestCases --module-arg 'CtsDeqpTestCases:include-filter:dEQP-GLES3.functional.primitive_restart.*'
Reviewed-on: https://swiftshader-review.googlesource.com/c/24548
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/libGLESv2/Context.cpp