Skip to content
DoS Advisory Advanced CVE-2026-6298

Heap buffer overflow in Skia (CVE-2026-6298)

A heap buffer overflow read occurs in the Chromium GPU process when a Canvas2D stroked shape with a shadow and a dash pattern of exactly 16364 intervals is drawn. An attacker could cause the GPU process to crash by reading far past the end of a key buffer.

86ac1f1587b71893ed2ad792cd7dde32 Follow

Originally disclosed on Chrome VRP

Critical View original
  • Fix shipped in 23 days

Note

This issue is a resubmission of the previous one: https://issues.chromium.org/issues/494644478. There was an error in describing the affected scope, which led to unsuccessful reproduction: This vulnerability affects desktop platforms using the Ganesh backend. Chromium on macOS defaults to Graphite. I have completed testing on Linux. Please reproduce using Linux Chromium.

Summary

A heap-buffer-overflow read occurs in the Chromium GPU process when a web page draws a Canvas2D stroked shape with a shadow and a dash pattern containing exactly 16364 intervals. The skgpu::ResourceKey::Builder packs the key's byte size into the upper 16 bits of a uint32_t, but only an SkASSERT guards against the size exceeding 65535 bytes. When the total key size reaches exactly 65536, the packed size truncates to zero. The subsequent call to ResourceKeyHash in Builder::finish computes a hash length of 0 - 4, which underflows as size_t to an enormous value, causing the hash function to read far past the end of the allocated key buffer. This vulnerability affects desktop platforms that use the Ganesh backend., with no special GPU hardware requirements.

Bisect

Introducing Commit: 24db3b1c35fb935660229da164fc5ad31977387f

  • Date: 2015-01-23
  • Author: bsalomon <[email protected]>
  • Review: https://codereview.chromium.org/858123002

Root Cause

The skgpu::ResourceKey::Builder constructor packs two fields into a single uint32_t metadata slot: the key's domain in the lower 16 bits and the key's total byte size in the upper 16 bits.

C++
// third_party/skia/src/gpu/ResourceKey.h:80-87
Builder(ResourceKey* key, uint32_t domain, int data32Count) : fKey(key) {
    size_t count = SkToSizeT(data32Count);
    key->fKey.reset(kMetaDataCnt + count);
    size_t size = (count + kMetaDataCnt) * sizeof(uint32_t);
    SkASSERT(SkToU16(size) == size);  // release: removed
    key->fKey[kDomainAndSize_MetaDataIdx] = SkToU32(domain | (size << 16));
}

The expression size << 16 is computed in size_t (64-bit), but the result is then truncated to uint32_t by SkToU32. When size equals 65536 (0x10000), the shift produces 0x100000000, which truncates to 0. The SkASSERT that would catch this is stripped in release builds.

Later, internalSize() extracts the packed size by shifting right:

C++
// third_party/skia/src/gpu/ResourceKey.h:159
size_t internalSize() const { return fKey[kDomainAndSize_MetaDataIdx] >> 16; }

This returns 0. When finish() calls ResourceKeyHash, it passes internalSize() - sizeof(uint32_t) as the byte count. Since internalSize() is 0 and the subtraction operates on size_t, the result underflows to 0xFFFFFFFFFFFFFFFC on 64-bit systems, causing the hash function (wyhash) to attempt reading approximately 18 exabytes of data starting from the key buffer.

C++
// third_party/skia/src/gpu/ResourceKey.h:62-67
void finish() {
    if (nullptr == fKey) { return; }
    uint32_t* hash = &fKey->fKey[kHash_MetaDataIdx];
    *hash = ResourceKeyHash(hash + 1, fKey->internalSize() - sizeof(uint32_t));
    // ...
}

The trigger path from web content uses Canvas2D's setLineDash() API, which accepts an array of arbitrary length (only validating that values are finite and non-negative). When combined with shadowBlur, the rendering path enters GrBlurUtils::DrawShapeWithMaskFilter, which applies the dash path effect to the shape and then constructs a cache key. The GrStyle::KeySize function returns 2 + dashIntervalCnt for the path effect portion, plus 4 for the stroke record. Combined with the geometric key (5 uint32s for a rect) and the fixed overhead in compute_key_and_clip_bounds (7 uint32s), the total data32Count passed to the Builder is dashIntervalCnt + 18. Adding the 2-element metadata prefix and multiplying by 4 bytes gives the total size as (dashIntervalCnt + 20) * 4. Setting dashIntervalCnt = 16364 yields 16384 * 4 = 65536 bytes, the exact overflow boundary.

Reproduce

Tested at commit e6831951cd5fd2d7db105507e6f5e06ba600e073 on Ubuntu 22.04.

Configure an ASAN build with the following args.gn in out/asan:

is_asan = true
is_debug = false
dcheck_always_on = false

Build Chrome with autoninja -C out/asan chrome. No source modifications are required; the PoC is a self-contained HTML file.

Or download the newest asan-chromium:

Bash
wget https://www.googleapis.com/download/storage/v1/b/chromium-browser-asan/o/linux-release%2Fasan-linux-release-1604232.zip\?generation\=1774375934171278\&alt\=media

Launch Chrome as follows:

Bash
out/asan/chrome --user-data-dir=./userdata poc.html

The GPU process will crash within seconds with an AddressSanitizer heap-buffer-overflow report originating from wyhash in SkChecksum.cpp, called through ResourceKey::Builder::finish in ResourceKey.h. The crash occurs because a 65536-byte ResourceKey buffer is read past its end when the size_t length argument underflows to a massive value. The ASAN summary line reads heap-buffer-overflow ... in wyhash(void const*, unsigned long, unsigned long, unsigned long const*) and the access is located 3 bytes after a 65536-byte heap region.

ASAN output:

=================================================================
==191842==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7a9b28cf4803 at pc 0x5e7ce9ad9692 bp 0x7ffd713380b0 sp 0x7ffd713380a8
READ of size 8 at 0x7a9b28cf4803 thread T0 (chrome)
    #0 0x5e7ce9ad9691 in wyhash(void const*, unsigned long, unsigned long, unsigned long const*) third_party/skia/src/core/SkChecksum.cpp:45:5
    #1 0x5e7d02ee0448 in skgpu::ganesh::SoftwarePathRenderer::onDrawPath(skgpu::ganesh::PathRenderer::DrawPathArgs const&) third_party/skia/src/gpu/ResourceKey.h:67:21
    #2 0x5e7d02cf7ad2 in skgpu::ganesh::SurfaceDrawContext::drawShapeUsingPathRenderer(GrClip const*, GrPaint&&, GrAA, SkMatrix const&, GrStyledShape&&, bool) third_party/skia/src/gpu/ganesh/SurfaceDrawContext.cpp:1897:9
    #3 0x5e7d02d005c7 in skgpu::ganesh::SurfaceDrawContext::drawShape(GrClip const*, GrPaint&&, GrAA, SkMatrix const&, GrStyledShape&&) third_party/skia/src/gpu/ganesh/SurfaceDrawContext.cpp:1561:11
    #4 0x5e7d02c003ec in GrBlurUtils::draw_shape_with_mask_filter(GrRecordingContext*, skgpu::ganesh::SurfaceDrawContext*, GrClip const*, GrPaint&&, SkMatrix const&, SkMaskFilterBase const*, GrStyledShape const&) third_party/skia/src/gpu/ganesh/GrBlurUtils.cpp:303:10
......

The complete ASAN log is attached as asan.txt.

References

Credit

Please use 86ac1f1587b71893ed2ad792cd7dde32 as the credit for this vulnerability. Thank you.

The original report as published on the Chromium issue tracker, by 86ac1f1587b71893ed2ad792cd7dde32. 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

The ResourceKey::Builder packs the key size into 16 bits without a release-build check, so a size of exactly 65536 truncates to zero and a later subtraction underflows to a huge length passed to the hash function.

Impact

The GPU process crashes, causing a denial of service; the text does not claim code execution.

What the attacker needed

Victim opens a malicious HTML page; desktop platform using Ganesh backend; Linux Chromium for reproduction

How it was found

  1. Build Chrome with AddressSanitizer enabled using the provided build flags.
  2. Create a self-contained HTML file that draws a Canvas2D stroked shape with a shadow and a dash pattern of 16364 intervals.
  3. Launch Chrome with the HTML file as the argument.
  4. Observe the GPU process crash with an AddressSanitizer heap-buffer-overflow report from wyhash.

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 web page can ask the browser to draw a dashed outline with a shadow. If the dash pattern has a very specific number of dashes, a calculation inside the graphics code goes wrong and the program tries to read a huge amount of memory, which crashes the graphics process. This is a denial-of-service bug, not a way to run attacker code.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 86ac1f1587b71893ed2ad792cd7dde32

View all

12 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.