Type confusion in ANGLE (CVE-2026-78905)
ANGLE's compiler pass that shrinks the built-in gl_ClipDistance and gl_CullDistance arrays updates the variable but leaves parent AST nodes with their original larger array types, producing a type mismatch. In release Chrome builds this malformed AST becomes invalid SPIR-V passed to the Vulkan driver, which could cause out-of-bounds memory access in the GPU process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
Project Fortify, 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 fails to re-promote parent AST node types after shrinking the built-in gl_ClipDistance or gl_CullDistance arrays, creating an AST type desynchronization. In production builds of Chrome where AST and SPIR-V validations are disabled, this results in malformed SPIR-V instructions being passed to the underlying platform Vulkan driver. Depending on the Vulkan compiler's robustness, this could potentially lead to out-of-bounds compiler memory accesses within the GPU process.
Affected files:
third_party/angle/src/compiler/translator/SizeClipCullDistance.cppthird_party/angle/src/compiler/translator/ParseContext.cppthird_party/angle/src/compiler/translator/spirv/OutputSPIRV.cpp
Estimated timestamp from git blame: 2025-10-01
Description
A potential vulnerability has been identified in ANGLE's handling of the built-in gl_ClipDistance and gl_CullDistance arrays. The compiler pre-declares gl_ClipDistance with the maximum supported size (typically float[8]). During parsing, if the array is only indexed up to a smaller boundary (e.g., gl_ClipDistance[0] = 1.0;), the SizeClipCullDistance compiler pass resizes the array variable to the actual used size (e.g., float[3]).
While the pass replaces the variable associated with the underlying TIntermSymbol nodes, the parent nodes in the AST (such as TIntermBinary representing variable initializations or TIntermAggregate representing function calls) retain their original cached types (float[8]) determined during parsing. This leads to a type desynchronization within the AST.
In release builds of Chrome, where AST and SPIR-V validations are compiled out, this malformed AST is translated directly into SPIR-V. The mismatch manifests as an invalid OpStore instruction where a value of the resized type (float[3]) is stored into a pointer of the unresized type (float[8]):
OpStore %ptr_float_8 %val_float_3
This violates Section 3.42.8 of the SPIR-V Specification, which mandates that the type of the Object operand must match the type pointed to by the Pointer operand. This malformed SPIR-V is then passed directly to the platform's Vulkan driver via vkCreateShaderModule in the GPU process.
Potential Impact
Passing structurally malformed SPIR-V to a Vulkan driver compiler can result in undefined behavior, including out-of-bounds memory writes or memory corruption during shader compilation. On platforms like Android, where the GPU process is currently unsandboxed, memory corruption in the Vulkan compiler could potentially facilitate a direct sandbox escape.
Potential Steps to Reproduce
Note: The following steps are theoretical and have not been executed on a live environment as this analysis was conducted via static code review.
-
Initialize a WebGL2 context and request the
GL_ANGLE_clip_cull_distanceorGL_EXT_clip_cull_distanceextension on a platform using ANGLE's Vulkan backend. -
Query the maximum allowed clip distances (
N, typically 8). -
Compile and attempt to link a vertex shader that references the whole
gl_ClipDistancearray (either via assignment to another array of sizeN, or by passing it to a function expecting an array of sizeN), while only writing to a single index:GLSL #version 300 es #extension GL_ANGLE_clip_cull_distance : require void f(highp float a[8]) { gl_Position = vec4(a[7]); } void main() { gl_ClipDistance[0] = 1.0; f(gl_ClipDistance); } -
Trigger program linkage to force the SPIR-V binary generation and subsequent submission to
vkCreateShaderModule.
Suggested Fix
When SizeClipCullDistance modifies the array bounds of the built-in variables, the AST must be traversed to update and re-promote the types of any parent nodes that reference the resized symbol. Alternatively, the compiler should ensure that any parent TIntermExpression caching type definitions (such as TIntermBinary and TIntermAggregate nodes) are forced to re-derive their types when a child variable is replaced, preventing type desynchronization prior to SPIR-V code generation.
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
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
The SizeClipCullDistance pass replaces the symbol node for the resized built-in array but does not re-promote the cached types of parent AST nodes, leaving the tree type-desynchronised.
Impact
Malformed SPIR-V could cause undefined behaviour in the Vulkan compiler, potentially leading to out-of-bounds memory access and, on unsandboxed Android GPU processes, a possible sandbox escape; the report notes this is theoretical and not executed.
What the attacker needed
Vulkan-backed ANGLE platform; clip/cull distance extension available; release Chrome build without validations; attacker-supplied shader
The fix
The compiler should traverse the AST after resizing and re-promote parent node types, or force parent expression nodes to re-derive their types when a child variable is replaced.
How it was found
- Create a WebGL2 context and enable the clip/cull distance extension on a Vulkan-backed ANGLE platform.
- Query the maximum number of clip distances supported.
- Compile and link a vertex shader that passes the whole gl_ClipDistance array to a function expecting the full size while writing only one index.
- Trigger program linkage so the SPIR-V binary is generated and submitted to the Vulkan driver.
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.
A shader compiler builds a tree of nodes representing the program, and each node remembers a data type. One optimisation shrinks a built-in array to the size actually used, but only the leaf node is updated, so a parent still thinks the array is bigger. The resulting mismatch is handed to the graphics driver as invalid intermediate code, which may confuse the driver's own compiler.
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.