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

Integer overflow in Skia (CVE-2026-9998)

SkSL's loop unrolling analysis uses double-precision arithmetic to estimate iteration counts, ignoring 32-bit integer wraparound at runtime. A malicious shader loop could pass ES2 validation but execute many more iterations, enabling out-of-bounds writes in the GPU process.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 14 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 Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: SkSL's loop unrolling analysis incorrectly calculates iteration counts using double-precision arithmetic without accounting for 32-bit integer wraparound at runtime. This can allow malicious loops to bypass ES2 validation while performing out-of-bounds array accesses on GPU backends. This issue potentially enables memory corruption within the GPU process from a compromised renderer.

Affected files:

  • third_party/skia/src/sksl/analysis/SkSLGetLoopUnrollInfo.cpp
  • third_party/skia/src/sksl/analysis/SkSLIsConstantExpression.cpp
  • third_party/skia/src/sksl/ir/SkSLIndexExpression.cpp
  • third_party/skia/src/sksl/codegen/SkSLSPIRVCodeGenerator.cpp
  • third_party/skia/src/sksl/codegen/SkSLGLSLCodeGenerator.cpp
  • third_party/skia/src/sksl/codegen/SkSLMetalCodeGenerator.cpp

Estimated timestamp from git blame: 2021-01-13

Description

A potential vulnerability exists in the SkSL (Skia Shading Language) compiler's loop unrolling analysis. The analysis determines if a loop is valid for ES2 (which requires loops to be unrollable) by calculating its trip count. However, the calculation in src/sksl/analysis/SkSLGetLoopUnrollInfo.cpp uses 64-bit floating-point arithmetic and does not account for the 32-bit signed integer wraparound behavior that occurs on GPU hardware at runtime.

In calculate_count, the trip count is estimated as follows:

C++
// src/sksl/analysis/SkSLGetLoopUnrollInfo.cpp
static int calculate_count(double start, double end, double delta, bool forwards, bool inclusive) {
    // ...
    double iterations = sk_ieee_double_divide(end - start, delta);
    double count = std::ceil(iterations);
    // ...
    return (int)count;
}

A loop such as for (int i = 2147483640; i < 2147483647; i += 100) is analyzed as having 1 iteration because ceil((2147483647 - 2147483640) / 100) is 1. However, at runtime on a GPU, i += 100 wraps to -2147483556. The condition -2147483556 < 2147483647 remains true, causing the loop to continue for approximately $2^{30}$ iterations.

Potential Impact

This discrepancy allows a loop to pass static ES2 validation while executing many more times than expected at runtime. Because SkSL enforces that array indices in ES2 loops must be constant-index-expressions (often based on the loop index), and the compiler does not perform value-range checking on these indices relative to the unroll analysis, an attacker can trigger out-of-bounds (OOB) writes.

For example, arr[i - 2147483640] would calculate an OOB index of 100 on the second iteration if arr is a small array. Most backends (SPIR-V, GLSL, Metal) emit these loops natively without runtime safety clamps. This provides a primitive for OOB writes into shader-local memory (stack/private storage) within the GPU process.

On platforms like Android, the GPU process is a privileged process (non-isolated, sharing a UID with the browser), meaning memory corruption here could lead to a full sandbox escape.

Suggested Attack Steps

  1. Compromise Renderer: Gain control of a sandboxed renderer process.
  2. Craft SkSL: Create a malicious SkSL string using the wraparound pattern to target an array OOB.
  3. Submit Shader: Use an API like SkRuntimeEffect::MakeForShader via a cc::PaintOp to force the GPU process to compile and execute the shader.
  4. Corrupt Memory: Use the OOB write to overwrite sensitive driver metadata or shader state in the GPU process memory space.

Note: These steps are theoretical as our current tooling cannot execute code or provide a functional PoC.

Recommended Fix

The calculate_count function in SkSLGetLoopUnrollInfo.cpp should be updated to simulate the 32-bit integer arithmetic of the induction variable, including wraparound behavior. If the simulation detects a wraparound or if the iteration count deviates from the floating-point calculation, the loop should be rejected as non-unrollable in ES2 mode.

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


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.

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 loop unrolling analysis uses floating-point arithmetic to compute trip counts without simulating the 32-bit integer wraparound that occurs on GPU hardware.

Impact

This could enable memory corruption in the GPU process, and on platforms like Android where the GPU process is privileged, it could lead to a full sandbox escape; however, the steps are theoretical and no functional proof of concept exists.

What the attacker needed

Compromised renderer process; ability to submit SkSL shaders

The fix

The calculate_count function should be updated to simulate 32-bit integer arithmetic including wraparound, and loops that wrap or deviate from the floating-point count should be rejected as non-unrollable in ES2 mode.

How it was found

  1. Compromise a sandboxed renderer process.
  2. Craft a SkSL shader with a loop that wraps around to cause an out-of-bounds array index.
  3. Submit the shader via an API such as SkRuntimeEffect::MakeForShader through a cc::PaintOp.
  4. Use the resulting out-of-bounds write to corrupt memory in the GPU process.

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.

Skia is a graphics library used by Chrome. It compiles small programs called shaders that run on the graphics card. The compiler checks that loops are simple enough to unroll, but it miscalculates how many times a loop will run when numbers wrap around, so a crafted loop can write outside an array and corrupt memory.

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.