Skip to content

[4.155] Backport four Skia CVE fixes and the emdawnwebgpu link fix (#5316) - #5797

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

mattleibow merged 2 commits into
mono:release/4.155.xfrom
ramezgerges:dev/backport-4.155-security-batch-2

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

Description

Second 4.155 servicing backport, following #5793. It brings four more Skia CVE fixes and #5316 to release/4.155.x, so they ship in 4.155.2.

Skia security fixes (all Chrome-assigned and rated High by Chromium; already shipped in 4.156.x; backported to m155 in mono/skia#462):

CVE Chromium bug Upstream fix
CVE-2026-118340: integer overflow, cross-origin data 568936530 8700229923 [skif] Update SkImageFilter_Base uniqueID to 64-bit
CVE-2026-119261: buffer overflow 574213633 0a8b2fc486 [SkSL] Reject invalid types when parsing
CVE-2026-121086: heap OOB write 569674218 50a301ac1c Fix potential heap OOB write in SkRgnBuilder for conic paths
CVE-2026-126912: heap-buffer-overflow 569286603 866b61ca92 Reland "Fix heap-buffer-overflow in RunBasedAdditiveBlitter and AAA convex walker"

#5316: ship emdawnwebgpu's webgpu.cpp inside libSkiaSharp.a. 4.155 includes #3968, so its WASM targets compile Dawn's webgpu.cpp on the app's emcc link line with -std=c++20. Clang rejects that for any C source the app also links (invalid argument '-std=c++20' not allowed with 'C'), which breaks every Uno Platform 7 WASM app (it links uno_gl_shim.c). The port is now built into libSkiaSharp.a through mono/skia#396's GN argument (cherry-picked in mono/skia#462), and the source, -std=c++20 and DEFAULT_TO_CXX come off the link line. The .targets and native/wasm/build.cake changes are identical, line for line, to #5316. They applied cleanly despite the files having drifted on 4.155.x. Only the submodule and cgmanifest.json pins differ.

This PR pins externals/skia to mono/skia#462's head 221ae11c53 and updates cgmanifest.json to match. upstream_merge_commit is unchanged. After mono/skia#462 merges, the pin should move to its merge commit, as was done when #5793 merged.

Related issues

Related to #5793 and #5316

Required skia PR

Requires mono/skia#462

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

  • Skia rejects or clamps the malformed inputs behind the four CVEs instead of overflowing. This matches 4.156.x.
  • WASM apps no longer compile webgpu.cpp at link time, and SkiaSharp no longer adds -std=c++20 or DEFAULT_TO_CXX to their link line, so apps that link C sources build. Apps must link the 4.155.2 libSkiaSharp.a, which contains the port. This is the same transition Ship emdawnwebgpu's webgpu.cpp inside libSkiaSharp.a #5316 made on main.

Testing

Checklist

  • Tests added or updated (if omitted, explain why above). The upstream regression tests travel with the Skia backport (ImageFilterCacheTest, SkSL error tests, RegionTest, RasterizationTests). The managed suites cannot exercise these GPU and rasterizer internals with malicious inputs.
  • 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

…ono#5316)

Pin externals/skia to an m155 backport carrying four more upstream Skia
security fixes, and backport mono#5316 (and its Skia half, mono/skia#396) so
WASM apps that link C sources build again.

~~ Skia security fixes (all Chrome-assigned, Chromium severity High) ~~

- CVE-2026-118340, integer overflow leaking cross-origin data. Chromium
  bug 568936530, upstream 8700229923 "[skif] Update SkImageFilter_Base
  uniqueID to 64-bit" (M156: c68d7fd343).
- CVE-2026-119261, SkSL buffer overflow. Chromium bug 574213633, upstream
  0a8b2fc486 "[SkSL] Reject invalid types when parsing" (M156: 961c7e83d9).
- CVE-2026-121086, heap OOB write in SkRgnBuilder for conic paths.
  Chromium bug 569674218, upstream 50a301ac1c (M156: c433a0fce9).
- CVE-2026-126912, heap-buffer-overflow in RunBasedAdditiveBlitter and the
  AAA convex walker. Chromium bug 569286603, upstream reland 866b61ca92
  (M156: 0ac7dc6087).

Google backported these to m156 and later but not m155. All four
M156 cherry-picks applied to m155 without conflicts.

~~ Ship emdawnwebgpu's webgpu.cpp inside libSkiaSharp.a (mono#5316) ~~

4.155 includes mono#3968, so its WASM targets compile Dawn's webgpu.cpp on the
app's emcc link line with -std=c++20, which clang rejects for any C source
the app links (for example Uno Platform 7's uno_gl_shim.c). Build the port
into libSkiaSharp.a through mono/skia#396's skiasharp_emdawnwebgpu_dir GN
argument instead, and stop putting the source, -std=c++20 and
DEFAULT_TO_CXX on the link line. The targets and build.cake changes are
identical to mono#5316; only the submodule and cgmanifest pins differ.

C API declarations, DEPS, managed APIs and package versions are unchanged,
and upstream_merge_commit still names the last incorporated chrome/m155
commit.

(cherry picked from commit 9745920)

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 -- 5797

PowerShell / Windows:

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

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-5797/packages --name skiasharp-pr-5797
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-5797

@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 added a commit to mono/skia that referenced this pull request Nov 17, 2026
[m155] Backport Skia security fixes and WASM build hook (#462)

Context: mono/SkiaSharp#5797
Context: #396
Context: mono/SkiaSharp#5316
Changes: 168d720...221ae11

Backport four Google m156 security fixes and the existing WASM hook
to 4.155. Preserve the m155 baseline, prior fork changes, C API and DEPS.

~~ CVE-2026-118340: image-filter cache ID wraparound ~~

32-bit filter IDs can wrap and collide with live cache entries.
Backport c68d7fd (upstream 8700229): use 64-bit filter/cache IDs
and initialize key padding for byte hashing. The regression distinguishes
IDs differing by 1 << 32 and checks independent cache results.

~~ CVE-2026-119261: reserved SkSL types outside declarations ~~

Private runtime-effect types alias the invalid type. Checking variable
declarations misses struct fields. Backport 961c7e8 (upstream
0a8b2fc): reject aliases in Parser::type, suppress duplicate diagnostics
and carry the struct-field regression and expected-error updates.

~~ CVE-2026-121086: conic region edge-buffer sizing ~~

Two budgeted edges per conic are insufficient for up to 32 subdivided
quadratics and 64 monotonic edges. Backport c433a0f (upstream
50a301a): share SkConic's subdivision limit, budget the worst case
and return an empty region on checked edge-count overflow.

Changed lines match upstream; m155's existing array syntax explains the
context difference, not a custom rewrite. Carry Region_ConicMaxEdges;
its 32-span trigger requires SK_SUPPORT_LEGACY_CONIC_CHOP.

~~ CVE-2026-126912: clipped convex rasterization ~~

Right-boundary edge cancellation can leave a convex walker without both
edges; stale scan positions across Y-gaps can overflow fixed-point X.
Backport 0ac7dc6 (upstream 866b61c): preserve required edges,
advance/flush across gaps, saturate/clamp X and reject non-positive runs.
Keep SK_LEGACY_ALPHA_RUNS guards and the convex-path/oval regression.

~~ Compile the WASM port before the application's mixed-language link ~~

Compiling webgpu.cpp on the app's emcc link line applies -std=c++20 to
C inputs too. Clang rejects this; Uno Platform 7's uno_gl_shim.c exposes it.

Backport #396 unchanged as 221ae11. A nonempty
skiasharp_emdawnwebgpu_dir on WASM builds the port into a static library
that SkiaSharp depends on; unset, it adds no target or dependency.
mono/SkiaSharp#5797 supplies the directory and backports the consumer
changes from mono/SkiaSharp#5316.

Retain mono/SkiaSharp#5316's accepted constraint: custom GPU-disabled
WASM archives can omit port exports required by .NET 9+ targets.
Shipping WASM packages remain GPU-enabled; this backport does not fix
the unsupported custom configuration.

Co-authored-by: alexis cruz-ayala <[email protected]>
Co-authored-by: Nathan Sanchez <[email protected]>
Co-authored-by: Thomas Smith <[email protected]>
Co-authored-by: Ramez Ragaa <[email protected]>
Co-authored-by: Ramez Ragaa <[email protected]>
Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Context: mono/skia#465

Point externals/skia and the matching component manifest entry at
e6cfc7a5d6dea7e8c21a59782c672a00b1fff28c. The repaired native history
contains all seven original reviewed commits from mono/skia#461 and
mono/skia#462 while retaining both squash landings.

The native tree is identical to reviewed head 221ae11c5318. This
changes only the two pins, not the security or WASM implementation.
For this combined repair, verify original-commit ancestry and tree
equality explicitly rather than requiring a direct-parent relationship.

Co-authored-by: Copilot App <[email protected]>
@mattleibow
mattleibow merged commit b0f72e0 into mono:release/4.155.x Nov 17, 2026
24 of 26 checks passed
@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.

2 participants