Type Confusion in Skia (CVE-2026-9983)
A logic error in Skia's PathOps coincidence-list handling leaves removed nodes reachable via the list head after consecutive removals. An attacker could supply crafted path geometry through Canvas2D or SVG to trigger intra-arena type confusion and out-of-bounds reads or writes in release builds.
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: A logic error in Skia's PathOps module causes coincidence lists to be incorrectly updated when multiple consecutive elements are removed. This results in 'released' spans remaining reachable via the list head, potentially leading to intra-arena type confusion and memory corruption during path processing.
Affected files:
third_party/skia/src/pathops/SkOpCoincidence.cppthird_party/skia/src/pathops/SkOpSpan.cpp
Estimated timestamp from git blame: 2016-07-18
Summary
A logic error exists in SkOpCoincidence::fixUp and SkOpCoincidence::markCollapsed within Skia's PathOps module. These functions fail to update a local reference to the coincidence list head after removing the first element. If subsequent elements also require removal, the unlinking logic operates on a stale pointer, leaving deleted nodes reachable via the list head (fHead or fTop).
Root Cause Analysis
In SkOpCoincidence::fixUp and SkOpCoincidence::markCollapsed, the head of the list is captured into a local variable head before iterating through and modifying the list:
// third_party/skia/src/pathops/SkOpCoincidence.cpp:1307
void SkOpCoincidence::fixUp(SkCoincidentSpans* coin, SkOpPtT* deleted, const SkOpPtT* kept) {
SkCoincidentSpans* head = coin; // Captured once
do {
if (coin->coinPtTStart() == deleted) {
if (coin->coinPtTEnd()->span() == kept->span()) {
this->release(head, coin); // Passes STALE head if a previous node was removed
continue;
}
// ...
}
} while ((coin = coin->next()));
}
The release(SkCoincidentSpans* head, SkCoincidentSpans* remove) helper uses the provided head pointer to walk the list and perform the unlinking. If release removes the current head of the list, it updates the member variable fHead. However, the caller's local variable head remains pointed at the old, now unlinked node.
If a subsequent node also matches the deletion criteria, the next call to release uses the stale head. The walk inside release starts at the unlinked node, finds the target node, and updates the next pointer of the unlinked node instead of updating fHead. This results in the target node remaining reachable via the actual fHead member.
Potential Impact
This vulnerability allows a "released" SkCoincidentSpans node to remain reachable in the coincidence list while containing pointers to deleted or merged span data.
Subsequent PathOps phases (e.g., correctEnds(), expand()) iterate this list and perform upCast() operations on the spans. If a degenerate span refers to a segment tail (SkOpSpanBase), the upCast() to SkOpSpan is invalid. In release builds where SkASSERT is disabled, this results in intra-arena type confusion, allowing out-of-bounds reads or writes to adjacent objects within the SkArenaAlloc used for the Path operation.
Suggested Potential Reproduction Steps
- Define a path with multiple overlapping (coincident) segments that share a common vertex.
- Perform a Path operation (e.g.,
SimplifyorOp) that triggers the merging of the shared vertex. - Ensure the coincidence list contains at least two consecutive nodes that will be released during the
fixUpphase. - The logic error should leave the second node reachable via
fHeaddespite its intended removal. - The vulnerability is reachable from the renderer process via attacker-controlled path geometry in Canvas2D or SVG.
Recommended Fix
Modify the release helper to take a pointer-to-pointer (SkCoincidentSpans** headPtr) or ensure that the calling functions update their local head pointer after a successful release. Using a pointer-to-pointer allows release to directly update the caller's state and correctly manage the list head update regardless of which list (fHead or fTop) is being processed.
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.
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 caller captures the list head in a local variable once, and the release helper updates only the member variable when removing the head, so a second removal uses a stale head pointer and unlinks the wrong node.
Impact
In release builds where assertions are disabled, this could allow out-of-bounds reads or writes within the path arena, reachable from the renderer via attacker-controlled Canvas2D or SVG geometry.
What the attacker needed
Attacker-controlled path geometry; release build without assertions; renderer process context
The fix
The release helper should take a pointer-to-pointer, or callers should refresh their local head pointer after a successful release, so the list head is updated correctly.
How it was found
- Define a path with multiple overlapping (coincident) segments that share a common vertex.
- Perform a Path operation (e.g., `Simplify` or `Op`) that triggers the merging of the shared vertex.
- Ensure the coincidence list contains at least two consecutive nodes that will be released during the `fixUp` phase.
- The logic error should leave the second node reachable via `fHead` despite its intended removal.
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 the graphics library Chrome uses to draw shapes. When it merges overlapping path segments it keeps a linked list of 'coincident' spans, and a bug means that after deleting one entry the code keeps using an old pointer to the list's start, so a deleted entry can still be reached. Later code then treats that stale entry as a different kind of object, which can read or write memory it should not.
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.