aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/Translator
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-10-28 17:53:04 -0700
committerbohu <bohu@google.com>2014-10-28 17:54:30 -0700
commitc4966e0ad3faa046c293f855e48e8125d6fcd8d0 (patch)
tree232ec5f14391b38a7b7331f7c6c882101f42ba54 /emulator/opengl/host/libs/Translator
parentcf7e8c7948b3b811a6693ac871d2578a2bdf0a46 (diff)
downloadsdk-c4966e0ad3faa046c293f855e48e8125d6fcd8d0.zip
sdk-c4966e0ad3faa046c293f855e48e8125d6fcd8d0.tar.gz
sdk-c4966e0ad3faa046c293f855e48e8125d6fcd8d0.tar.bz2
Validate glClear mask
The mask should only be a combination of GL_DEPTH_BUFFER_BIT, GL_COLOR_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT Change-Id: Ic448bd33a9bf0dc50db4298a53e96dd128fd110c
Diffstat (limited to 'emulator/opengl/host/libs/Translator')
-rw-r--r--emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
index fe64f6f..16534c1 100644
--- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
@@ -323,6 +323,9 @@ GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target){
GL_APICALL void GL_APIENTRY glClear(GLbitfield mask){
GET_CTX();
+ GLbitfield allowed_bits = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+ GLbitfield has_disallowed_bits = (mask & ~allowed_bits);
+ SET_ERROR_IF(has_disallowed_bits, GL_INVALID_VALUE);
ctx->drawValidate();
ctx->dispatcher().glClear(mask);