Skip to content
Memory corruption Advisory Advanced CVE-2026-8519

Integer overflow in ANGLE (CVE-2026-8519)

A 32-bit integer overflow in ANGLE's constant array constructor calculation can allocate an undersized buffer, after which a loop writes far past its end. An attacker could trigger this through a WebGL2 shader on 32-bit platforms, causing a large out-of-bounds heap write that may lead to code execution.

Google Chrome

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 42 days

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 without the security team.

Overview: A 32-bit integer overflow can occur in ANGLE's TIntermAggregate::getConstantValue when multiplying elementSize by getOutermostArraySize(). This results in an undersized memory allocation followed by a massive out-of-bounds heap write during constant array initialization. The issue is reachable via WebGL2 and impacts 32-bit platforms such as Android ARMv7.

Affected files:

  • third_party/angle/src/compiler/translator/IntermNode.cpp
  • third_party/angle/src/compiler/translator/ParseContext.cpp
  • third_party/angle/src/common/PoolAlloc.cpp
  • third_party/angle/src/compiler/translator/Types.cpp

Estimated timestamp from git blame: 2026-01-21

Description

A potential integer overflow vulnerability exists in the ANGLE compiler's TIntermAggregate::getConstantValue function. When processing constant array constructors, the code calculates the required size for a new TConstantUnion array by multiplying the element size by the number of elements. On 32-bit systems, this multiplication can overflow the 32-bit size_t, leading to an undersized memory allocation. The subsequent loop, which initializes the array using memcpy, continues for the full number of elements, resulting in a linear out-of-bounds heap write.

Technical Details

In third_party/angle/src/compiler/translator/IntermNode.cpp around line 878, the array-constructor path performs the following calculation:

C++
size_t elementSize = mArguments.front()->getAsTyped()->getType().getObjectSize();
constArray         = new TConstantUnion[elementSize * getOutermostArraySize()];

On 32-bit targets, if elementSize * getOutermostArraySize() exceeds UINT_MAX, the product wraps around. This causes the allocation of an undersized buffer. The following loop then performs getOutermostArraySize() iterations of memcpy, writing far past the end of the allocated buffer.

C++
        size_t elementOffset = 0u;
        for (TIntermNode *constructorArg : mArguments)
        {
            const TConstantUnion *elementConstArray =
                constructorArg->getAsTyped()->getConstantValue();
            ASSERT(elementConstArray);
            size_t elementSizeBytes = sizeof(TConstantUnion) * elementSize;
            memcpy(static_cast<void *>(&constArray[elementOffset]),
                   static_cast<const void *>(elementConstArray), elementSizeBytes);
            elementOffset += elementSize;
        }

Amplification and Mitigations Bypassed

  1. Constant Amplification: Through the use of nested structures and large constant arrays, an attacker can geometrically increase the elementSize without exceeding parser depth limits. For example, a struct containing an array of structs can multiply the size at each level of nesting.
  2. Size Check Bypass: While ANGLE includes a checkVariableSize function (in ParseContext.cpp), it does not prevent this overflow. The function issues an error but returns void, and the caller declareVariable ignores the error state, returning true and allowing the process to continue to executeInitializer. Furthermore, if an error has already been recorded (e.g., from a preliminary large constant declaration or syntax error), checkVariableSize short-circuits due to a numErrors() > 0 check, skipping the size validation entirely for subsequent variables.
  3. Allocator Behavior: The allocation uses PoolAllocator, which for large allocations falls back to new (std::nothrow) uint8_t[] (in PoolAlloc.cpp:320). This typically results in a standalone heap chunk (PartitionAlloc in Chrome). The OOB write will corrupt adjacent heap objects.

Potential Exploitation Steps

While our tooling agent cannot execute code to provide a working proof-of-concept, the following steps suggest how an attacker might trigger the vulnerability:

  1. Craft a WebGL2 shader (ESSL 3.00) targeted at a 32-bit platform (e.g., Android ARMv7).

  2. Define nested structures to amplify the object size to a large value, e.g., 0x10000 (65,536).

    GLSL
    #version 300 es
    precision highp float;
    struct S  { float a[256]; };       
    struct S2 { S     b[256]; };       
    
  3. Declare a massive constant array of these structures, where the outermost array size is 0x10001 (65,537).

    GLSL
    const float A[256] = float[256](... 256 float literals ...);
    const S  sA     = S(A);
    const S  B[256] = S[256](sA, sA, ..., sA);
    const S2 sB     = S2(B);
    // elementSize = 0x10000 (65536)
    // arraySize = 0x10001 (65537)
    // product = 0x100010000 -> wraps to 0x10000 on 32-bit
    const S2 D[65537] = S2[65537](sB, sB, ..., sB);
    void main(){}
    
  4. Calling gl.compileShader() with this source will trigger the heap OOB write during the constant folding of variable D.

  5. The loop performs a massive linear out-of-bounds write of the attacker-controlled constant data. Although this will eventually hit an unmapped page and crash, an attacker can use concurrent Web Workers to spray objects in the GPU process heap and exploit the race window to achieve remote code execution before the crash occurs.

Suggested Fix

The multiplication in TIntermAggregate::getConstantValue should use safe math operations (e.g., using a checked math class) to prevent integer overflow. If an overflow is detected, the function should handle the error gracefully without allocating undersized memory. Additionally, checkVariableSize in ParseContext.cpp should perhaps halt the compilation or prevent executeInitializer from being called if the variable exceeds maximum size limits.

Evaluated with Chrome root at commit: ff3d2b74fa39431785bd60e51463b08fcc71ee33


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 size calculation multiplies element size by array length without an overflow check, and the existing size validation does not stop compilation.

Impact

The write is attacker-controlled constant data and will likely crash, but the report suggests heap spraying from Web Workers could allow code execution before the crash; this is unproven and limited to 32-bit platforms.

What the attacker needed

32-bit platform such as Android ARMv7; ability to supply a WebGL2 shader

The fix

The multiplication should use checked arithmetic and handle overflow gracefully, and the size check should halt compilation instead of being ignored.

How it was found

  1. Craft a WebGL2 shader for a 32-bit platform such as Android ARMv7.
  2. Define nested structures so the object size grows to a large value.
  3. Declare a huge constant array whose size times element size overflows 32 bits.
  4. Compile the shader to trigger the out-of-bounds heap write during constant folding.

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.

When a program needs memory for a list of items, it multiplies the size of one item by how many there are. On some systems that number can wrap around to a small value, so too little memory is reserved, and the program then writes far beyond it, corrupting other data. Here a graphics shader could cause that, and corrupted memory can sometimes be turned into running an attacker's code.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.