Skip to content

[4.155] Backport CVE-2026-126871 and CVE-2026-126882 Skia fixes - #5793

Merged
mattleibow merged 2 commits into
mono:release/4.155.xfrom
ramezgerges:dev/backport-4.155-cve-2026-126871-126882
Nov 17, 2026
Merged

mattleibow merged 2 commits into
mono:release/4.155.xfrom
ramezgerges:dev/backport-4.155-cve-2026-126871-126882

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

Description

Brings the fixes for CVE-2026-126871 and CVE-2026-126882 to the 4.155 servicing line, so they ship in 4.155.2. 4.156.1 already contains both, through #5687.

Both are Chrome-assigned Skia vulnerabilities, rated High by Chromium and fixed in Chrome 157.0.8103.78. Google cherry-picked the fixes to chrome/m156–m158 but not m155, so they are backported manually in mono/skia#461:

CVE Chromium bug Upstream fix
CVE-2026-126871: out-of-bounds read 574218401 98b65969e9 [graphite] Gracefully handle pathological number of clip draws
CVE-2026-126882: cross-origin information leak 578685706 3ecdbc38a9 [ganesh] Fix skew matrix multiply in EllipticalRRectOp and avoid self intersections

This PR pins externals/skia to the backport head 74a1a34d40 and updates the mono/skia hash in cgmanifest.json, following the earlier 4.155 sync (#5701). upstream_merge_commit is unchanged, because no new chrome/m155 commit is merged; the fixes are cherry-picks from M156. Once mono/skia#461 is merged, the gitlink and manifest should be repinned to its merge commit, as was done in #5687 and #5711.

Related issues

Related to #5687

Required skia PR

Requires mono/skia#461

Areas affected

  • Managed API (binding/)
  • Native / C API (externals/skia/src/c, include/c)
  • Generated P/Invoke bindings
  • Native dependency or Skia update (libpng, HarfBuzz, FreeType, zlib, milestone bump, …)
  • Views & integrations (MAUI, Uno, WPF, WinUI, Blazor, …)
  • Rendering output / visual behavior
  • Performance
  • Tests
  • Build, packaging, or CI
  • Documentation or samples

Changes

None. Public API, C API, bindings and package versions are unchanged.

Behavior

  • Graphite: a draw whose clip stack cannot fit in a single draw pass is skipped with a warning, instead of overflowing the pass.
  • Ganesh: elliptical rounded rectangles under skew or anisotropic transforms are drawn with corrected geometry.

These are the same behaviors 4.156.1 already ships.

Testing

  • The native backport was reviewed against the M156 cherry-picks; see [m155] Backport CVE-2026-126871 and CVE-2026-126882 fixes skia#461 for the conflict resolution and the m155 API checks.
  • Natives were not built locally (no native toolchain is available on the authoring machine). This PR's CI builds them from the pinned commit on all platforms and runs the test suites.
  • No new SkiaSharp test is added. The upstream regression test for the Graphite fix (DeviceTestClipRenderStepLimits) is carried in the Skia backport. The vulnerabilities depend on GPU-backend internals and malicious inputs, which the managed suites cannot exercise directly.

Checklist

  • Tests added or updated (if omitted, explain why above)
  • Changes above lists all public API and behavioral changes (or "None.")
  • New/changed public API? Added or updated accurate source /// documentation and regenerated bindings when applicable
  • Native change? Companion mono/skia PR linked above and bindings regenerated (no C API change, so there is nothing to regenerate)

🤖 Generated with Claude Code

Pin externals/skia to the m155 backport of the two upstream Skia security
fixes that 4.156.1 already ships (via mono#5687), so the 4.155 servicing line
gets them in 4.155.2. Both CVEs are Chrome-assigned, rated High by
Chromium, and fixed in Chrome 157.0.8103.78; Google cherry-picked them to
chrome/m156-m158 but not to m155.

~~ CVE-2026-126871: Graphite clip draws overflowing a draw pass ~~

Chromium bug 574218401, upstream 98b65969e9 (M156: 160aff2851).
DrawListLayer recorded clip draws without counting them against the draw
pass's render-step limit, so pipeline data structures could overflow
(out-of-bounds read). Count the clip elements that still need recording
when deciding whether to flush, and skip, with a warning, a draw whose
full clip stack cannot fit in a fresh pass.

~~ CVE-2026-126882: Ganesh elliptical rrect skew matrix multiply ~~

Chromium bug 578685706, upstream 3ecdbc38a9 (M156: 24e65cdd9b).
Fix the skew matrix multiply in EllipticalRRectOp and clamp transformed
corner radii so the generated geometry cannot self-intersect
(cross-origin information leak).

The graphite cherry-pick conflicted only on surrounding M156 code that
does not exist on m155; the m155 code is kept and every functional line
matches the M156 fix. The ganesh fix applied cleanly. C API declarations,
DEPS, managed APIs and package versions are unchanged, and
upstream_merge_commit still names the last incorporated chrome/m155 commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 5793

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5793"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-5793/packages --name skiasharp-pr-5793
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-5793

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @ramezgerges! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

mattleibow pushed a commit to mono/skia that referenced this pull request Nov 17, 2026
[m155] Backport Graphite and Ganesh security fixes (#461)

Context: mono/SkiaSharp#5793
Context: 160aff2
Context: 24e65cd

Bring the M156 security fixes for CVE-2026-126871 and CVE-2026-126882
to the SkiaSharp 4.155 servicing line.

~~ Graphite clip draw limits ~~

DrawListLayer records clip draws immediately, but the flush decision
did not account for undrawn clip elements. A pathological clip stack
could therefore exceed draw-pass limits and overflow pipeline data.

Count undrawn effective clips when deciding whether to flush. After a
flush, all effective clips must be recorded again; if they and the draw
cannot fit in a fresh pass, skip the draw and log a warning instead.
Retain the M155 style argument and flush code when resolving the
backport conflicts. DeviceTestClipRenderStepLimits exercises repeated
draws, oversized clip stacks, and a subsequent normal draw.

~~ Ganesh transformed rounded rectangles ~~

The elliptical rounded-rectangle path used the wrong skew matrix
components when mapping radii and stroke widths. Correct the matrix
multiplication and clamp transformed corner radii to the mapped
bounds, preventing self-intersections and correcting affected geometry.
The M156 fix applied without conflicts.

The backport was checked against the M156 changes, but native M155
builds and tests were not run locally.

Co-authored-by: Ramez Ragaa <[email protected]>
Co-authored-by: Thomas Smith <[email protected]>
Co-authored-by: Michael Ludwig <[email protected]>
Repin externals/skia and cgmanifest.json from 74a1a34d40d433801a370d9d61fef5abb7bb06b1 to 168d7202034d3791b4c222ff2f27cca314a100c8 after mono/skia#461 was squash-merged. The committed native tree is identical to the reviewed backport tree.

Co-authored-by: Copilot App <[email protected]>
@mattleibow
mattleibow merged commit 124a1a4 into mono:release/4.155.x Nov 17, 2026
24 of 85 checks passed
@ramezgerges
ramezgerges deleted the dev/backport-4.155-cve-2026-126871-126882 branch November 17, 2026 17:38
@github-actions github-actions Bot added this to the 4.155.2 milestone Nov 18, 2026
mattleibow pushed a commit that referenced this pull request Nov 24, 2026
[4.155] Backport the remaining 25 Skia CVE fixes (#5844)

Context: #5793, #5797
Requires: mono/skia#471 (merged as `6b4b729abd0d`)
Changes: mono/skia@e6cfc7a...6b4b729

4.155 is the last SkiaSharp line available to Uno Platform 6 apps, so
these fixes cannot be replaced by asking those users to move to a newer
line. Together with #5793 and #5797, this backport brings the 31 Skia
CVEs announced in Chrome stable releases since Chrome 156 to the 4.155
servicing line.

The native backport contains 38 upstream cherry-picks: 25 CVE fixes and
13 additional M156 hardening and test fixes. The 4.155 baseline points
to `e6cfc7a5d6dea7e8c21a59782c672a00b1fff28c`; the merged native commit
has that base and the reviewed head as parents, and its tree matches the
reviewed head. This PR updates only `externals/skia` and its matching
Component Governance pin. Public APIs, C API, bindings and package
versions are unchanged.

~~ Raster-pipeline bounds and failed shader stages ~~

Guard SkSL raster-pipeline slot counts and temporary stack-depth
arithmetic against overflow, and reject negative slot counts
(CVE-2026-118348, CVE-2026-118319). On shader-stage failure, neutralize
pending branch offsets and propagate child-shader failure so an
incomplete pipeline is not executed (CVE-2026-121084). The test conflict
was limited to M156-only context: the m155 tests remain, with the new
regression test and its required include added.

~~ Resource references during unique-key changes ~~

Keep a cache reference while changing a resource's unique key, so a
zero-refcount resource is not left in the purgeable queue
(CVE-2026-118351).

~~ Failed deferred uploads ~~

Propagate ASAP and inline upload failures through Ganesh flushes, skip
draws that could sample unwritten texture memory, and evict failed atlas
plots so cached clients are purged (CVE-2026-121072).

~~ Flush-token tracking across empty flushes ~~

Advance the token tracker even when a flush executes no draws; otherwise
per-flush atlas token comparisons can remain stale
(CVE-2026-126844). The deferred-upload reset also retains this token
advance alongside clearing the upload-failure state.

~~ Vulkan device-loss and render-pass state ~~

Treat `VK_ERROR_UNKNOWN` as device loss (CVE-2026-118354), initialize
the current render-pass pointer (CVE-2026-126915), check
`vkWaitForFences`, and apply the upstream 1 ms delay after device loss
on affected GPUs (CVE-2026-126846).

~~ Sampling outside texture subsets ~~

Nearest-filter coordinates can round outside a touching subset edge
after magnification. Retain the clamp unless the transform is a safe
1:1 integer mapping (CVE-2026-121227). Clamp coverage-mask sampling
(CVE-2026-126884) and account for AA/MSAA coordinate extrapolation when
deciding whether image-filter subset padding is sufficient. The
backport includes the nearest-subset regression test.

~~ Direct-mask Slug data and replay ~~

Direct-mask glyphs have no atlas padding when bilinear sampling is
unavailable. Reject fractional or incompatible replay
(CVE-2026-126894), and validate deserialized positions, matrices, bounds,
scales and flags before atlas sampling (CVE-2026-126922). Direct
positions must be finite integers within +/-2^21; the wire format is
unchanged. The regression tests include the protected-context case.

~~ Glyph allocation and scaler bounds ~~

Check SDF dimensions and scratch-buffer arithmetic, use fallible
allocation, and avoid rasterizing oversized glyphs that will not fit the
atlas (CVE-2026-126876). Guard the second unfiltered glyph load before it
can alias the original buffer (CVE-2026-131013). Related hardening
covers mask-filtered glyph copies and LCD16 cropping when stateful
scalers return different bounds or formats across loads.

~~ Graphite clip and stroke bounds ~~

Include hairline and subpixel strokes in clip inflation
(CVE-2026-121160), correct wedge miter inflation (CVE-2026-126841),
recognize inverse fills that cover the scissor as flood fills
(CVE-2026-126898), and use a save-record key when clip-path bounds do
not fit the packed int16 representation (CVE-2026-126857).

~~ Ganesh stroke geometry under transforms ~~

Compute op bounds in device space to match tessellator calculations
(CVE-2026-126914). Handle negative determinants when constructing
hairline square caps, and reject non-finite inverse-determinant results
(CVE-2026-126848).

~~ GPU transfer formats and channel layouts ~~

Disable unsupported BGRA-as-RGBx writes on GLES
(CVE-2026-119271). For Graphite A-to-RGBx readback, select RGBA with
forced opaque alpha so the transfer writes the expected destination
bytes (CVE-2026-126853).

~~ Cache-key comparison and hashing ~~

Compare Graphite PaintParamsKey data by byte length rather than element
count (CVE-2026-121032). Align image-filter cache equality with its
byte-based hash, including the type mask, and use float2 displacement
offsets so shader precision agrees with fp32 bounds calculations.

~~ Atlas indices under float interpolation ~~

Apply the half-step and integer conversion to Ganesh atlas indices;
flat interpolation is only a hint, not a guarantee
(CVE-2026-126920).

~~ Framebuffer lifetime on Imagination drivers ~~

Keep a complete guard FBO for the context and bind it around framebuffer
changes so a deleted FBO is not retained as the driver's previous
binding.

~~ Ganesh buffer-allocation overflow ~~

Check alignment, padding and allocation-size arithmetic; make CPU buffer
allocation fallible and bound initial preallocation.

~~ Graphite depth and painter order ~~

Reset depth and bounds tracking when an overwriting draw discards prior
draws, preventing depth wrap from changing painter order.

~~ Image-filter mipmap contamination ~~

Share mipmap downgrade logic across SpecialImage drawing paths so
unwritten scratch-texture contents do not enter filtered output. Include
the upstream regression tests and their build registration.

The native PR syntax-compiled 44 changed C++ sources under `src/` against
m155. Metal and Direct3D render-pass files were not checked locally; no
full native build or test run was performed locally.

Co-authored-by: Ramez Ragaa <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants