Insufficient validation of untrusted input in ANGLE (CVE-2026-17655)
ANGLE's GLSL compiler checks the size of explicitly declared variables but not of anonymous temporary objects built with inline constructors, so a shader can create a temporary larger than 2GB. The oversized type is passed to the native graphics driver, where 32-bit size and offset arithmetic could overflow and cause memory corruption in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 49 days
Flapjack, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: ANGLE's GLSL compiler enforces a 2GB limit on variable sizes to prevent integer overflows in native graphics drivers. However, TParseContext::addConstructor fails to check the size of anonymous temporary objects created via inline constructors. An attacker can instantiate nested structures exceeding 2GB inline, bypassing validation and potentially causing overflows and memory corruption in the native GPU driver.
Affected files:
third_party/angle/src/compiler/translator/ParseContext.cpp
Estimated timestamp from git blame: Unknown (Google3 checkout)
Description
ANGLE's GLSL compiler implements security mitigations to prevent unprivileged WebGL shaders from triggering integer overflows in underlying native graphics drivers. Specifically, the function TParseContext::checkVariableSize limits individual variables to 2GB (kWebGLMaxVariableSizeInBytes) and private/temporary variables to 64KB (kWebGLMaxPrivateVariableSizeInBytes).
While explicitly declared variables are properly validated in TParseContext::declareVariable, this size validation is completely missing when a massive object is instantiated as an anonymous temporary expression. In third_party/angle/src/compiler/translator/ParseContext.cpp, the TParseContext::addConstructor function creates the AST node for a constructor call but fails to invoke checkVariableSize on the constructed type. Furthermore, because it never enters checkVariableSize, it bypasses the accumulator mTotalPrivateVariablesSize, evading the 16MB kWebGLMaxTotalPrivateVariableSizeInBytes limit.
Impact
By generating GLSL that contains a massive anonymous temporary object, ANGLE translates and passes the shader to the native graphics driver (e.g., Adreno, Mali, Metal). Native driver compilers frequently use 32-bit signed or unsigned integers for layout and offset calculations. Parsing a >2GB or >4GB temporary object will predictably trigger integer overflows, potentially resulting in undersized heap allocations or out-of-bounds stack accesses during compilation or runtime execution.
Memory corruption in the GPU process can lead to Remote Code Execution. On platforms where the GPU process is unsandboxed (e.g., Android), this translates to an immediate sandbox escape.
Potential Steps to Reproduce
Note: These are theoretical steps, as our tooling cannot currently execute code to produce a working PoC.
- Initialize a WebGL 2.0 context.
- Compile a GLSL shader that defines nested structures to construct a 4GB type without exceeding the
kWebGLMaxStructNesting(4) orkMaxFieldCount(16383) limits.
#version 300 es
precision highp float;
struct S1 { mat4 m[1024]; }; // 64KB, depth 1
struct S2 { S1 f0; S1 f1; /* ... 1024 fields ... */ S1 f1023; }; // 64MB, depth 2
struct S3 { S2 g0; S2 g1; /* ... 64 fields ... */ S2 g63; }; // 4GB, depth 3
out vec4 color;
void main() {
S1 s1;
// The constructor for S3 bypasses checkVariableSize because it is an inline temporary.
color = S3(S2(s1, s1 /* ... */), S2(s1, s1 /* ... */) /* ... */).g0.f0.m[0][0];
}
- Pass this shader to
gl.compileShader. ANGLE will parse the massiveS3(...)temporary and create the AST without throwing a size error. - The translated code is passed to the native driver, where the 4GB allocation likely overflows 32-bit offset/size calculations.
Suggested Fix
In third_party/angle/src/compiler/translator/ParseContext.cpp, update TParseContext::addConstructor to call checkVariableSize on the constructor's return type before creating the AST node.
TIntermTyped *TParseContext::addConstructor(TFunctionLookup *fnCall, const TSourceLoc &line)
{
TType type = fnCall->constructorType();
if (!checkVariableSize(line, ImmutableString(""), &type))
{
return CreateZeroNode(type);
}
// ... proceed with checking arguments
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the constructor handling path in the GLSL parser creates the AST node for a temporary without running the same variable-size check (and private-variable accounting) that declared variables go through.
Impact
Memory corruption in the GPU process could lead to remote code execution, and on platforms where that process is unsandboxed it may amount to a sandbox escape; the report notes the steps are theoretical and no working proof of concept was produced.
What the attacker needed
Victim loads a page with attacker WebGL; WebGL 2.0 support; native driver with 32-bit size maths
The fix
The constructor path should call the variable-size check on the constructed type before building the AST node, as the report's suggested patch does.
How it was found
- Create a WebGL 2.0 context.
- Write a shader with nested structs that builds a roughly 4GB type while staying under the struct nesting and field count limits.
- Compile the shader; ANGLE accepts the large inline temporary without a size error.
- The translated shader reaches the native driver, where the large size may overflow 32-bit calculations.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
WebGL lets a web page send small programs called shaders to the graphics card. The browser's shader translator (ANGLE) has guards that stop a shader from declaring something absurdly large, because graphics drivers can mishandle huge sizes. Here the guard was skipped for values created on the fly inside an expression, so a page could hand the driver a multi-gigabyte value and possibly crash or corrupt the graphics process.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.