Commit b0d39ba2 by Alexis Hetu Committed by Commit Bot

Add array bounds checks for WebGL shaders

WebGL shaders may contain OOB array accesses which in turn cause undefined behavior, which may result in security issues. This was detected as an UNKNOWN READ by UBSAN while testing with SwANGLE. Bug: chromium:1189110 Change-Id: I00f56e771ed0c675abb465fc3a3dc9d62ea8ed51 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2892286Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Alexis Hétu <sugoi@chromium.org>
parent 9809122d
...@@ -37,6 +37,10 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte ...@@ -37,6 +37,10 @@ std::shared_ptr<WaitableCompileEvent> ShaderVk::compile(const gl::Context *conte
// Extra initialization in spirv shader may affect performance. // Extra initialization in spirv shader may affect performance.
compileOptions |= SH_INITIALIZE_UNINITIALIZED_LOCALS; compileOptions |= SH_INITIALIZE_UNINITIALIZED_LOCALS;
// WebGL shaders may contain OOB array accesses which in turn cause undefined behavior,
// which may result in security issues. See https://crbug.com/1189110.
compileOptions |= SH_CLAMP_INDIRECT_ARRAY_BOUNDS;
if (mState.getShaderType() != gl::ShaderType::Compute) if (mState.getShaderType() != gl::ShaderType::Compute)
{ {
compileOptions |= SH_INIT_OUTPUT_VARIABLES; compileOptions |= SH_INIT_OUTPUT_VARIABLES;
......
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