Skip to content

[skia-sync] Merge upstream chrome/m151 bug fixes - #4382

Merged
mattleibow merged 2 commits into
mainfrom
skia-sync/m151
Jul 10, 2026
Merged

mattleibow merged 2 commits into
mainfrom
skia-sync/m151

Conversation

@mattleibow

Copy link
Copy Markdown
Contributor

Automated upstream bug-fix sync for m151.

Companion skia PR: mono/skia#282

Automated upstream bug-fix sync for m151. Targets main (mono/skia skiasharp).

[skia-sync] Merge upstream chrome/m151 bug fixes — mono/SkiaSharp

Base branch: main
Head branch: skia-sync/m151
Mode: same-milestone bug-fix sync (CURRENT == TARGET == m151, IS_RELEASE == false)
Companion mono/skia PR: [skia-sync] Merge upstream chrome/m151 bug fixes on
skia-sync/m151 (submodule pointer advanced to reflect it)

Breaking-change analysis

None. Only one new upstream commit was pulled in
(0208108c7a [M151] Fix Use-After-Free in SubRunAllocator), and it is a pure
internal C++ fix in src/text/gpu/SubRunAllocator.h — it changes the
destruction order of an internal allocator return type from std::tuple to a
custom struct.

Category Risk Findings
Removed APIs 🔴 HIGH None
Renamed/Moved APIs 🟡 MEDIUM None
New APIs 🟢 LOW None
Behavior changes 🟡 MEDIUM None (bug fix restores correct behavior)
Graphite-only ⚪ SKIP N/A

No C API impact (grep SubRunAllocator src/c/ include/c/ returns nothing), no
header changes reachable from include/c/*.h, no binding regeneration delta.

This is the same fix that already landed on chrome/m150 and was pulled into
our fork on the release/4.150.x branch (companion sync PRs
mono/skia#281 /
mono/SkiaSharp#4379); it has now
been cherry-picked to chrome/m151 upstream and is being brought into the
main line here.

Version / binding updates

No version bump — this is a same-milestone sync, so scripts/VERSIONS.txt
and scripts/azure-templates-variables.yml are untouched (verified: git diff
on both files is empty after running the Phase 6 script with
-Current 151 -Target 151 -UpstreamRef chrome/m151).

cgmanifest.json:

  • commitHash: 98877992a5… → ff9099d996… (new mono/skia merge commit)
  • upstream_merge_commit: 1536d39750… → 0208108c7a… (new upstream tip)
  • chrome_milestone: 151 (unchanged)

externals/skia submodule pointer: 98877992a5 → ff9099d996 (points at
the new merge commit on skia-sync/m151).

C# changes

None. Binding regeneration (pwsh .agents/skills/update-skia/scripts/regenerate-bindings.ps1) produced zero
diff
across binding/SkiaSharp/SkiaApi.generated.cs and the
Skottie/SceneGraph/Resources generated files. The Phase 9 new-function check
(git diff origin/main -- binding/SkiaSharp/SkiaApi.generated.cs | grep '^+.*internal static')
returned zero matches, so no C# wrappers need to be added.

Build & test results (Linux x64)

Step Result
Native build (dotnet cake --target=externals-linux --arch=x64) ✅ Succeeded (15m 40s; libSkiaSharp 14:16, libHarfBuzzSharp 1:11, git-sync-deps 0:10)
Binding regeneration ✅ Succeeded, zero binding diff
C# build (dotnet build binding/SkiaSharp/SkiaSharp.csproj) ✅ Succeeded (0 warnings, 0 errors, all target frameworks)
Test suite (all SkiaSharp.Tests.Console tests) ✅ Passed: 5614, Failed: 0, Skipped: 182, Total: 5796 (2m 39s)

Both native artifacts produced as expected:

  • output/native/linux/x64/libSkiaSharp.so → libSkiaSharp.so.151.0.0 (11 MB — soname 151.0.0 = our tracked milestone)
  • output/native/linux/x64/libHarfBuzzSharp.so → libHarfBuzzSharp.so.0.61421.0 (2.8 MB)

Full test log uploaded as test-output.txt workflow artifact.

Items needing human attention

None. This is a minimal internal C++ bug fix from upstream Skia's m151 branch
with:

  • Zero API surface impact
  • Zero binding delta
  • Zero C# code changes
  • Zero test regressions (5614 passed)

Only Linux x64 was built and tested in this automated sync — macOS, Windows,
iOS, Android, WASM, and Tizen are covered by the normal CI matrix on the PR.

Companion mono/skia PR

The submodule now points at commit ff9099d996 on the skia-sync/m151 branch
of mono/skia. That PR must merge first; then this PR's submodule pointer will
be re-fetched to the squashed SHA before merging here.

Created by skia-upstream-sync.

Created by skia-upstream-sync.

Automated same-milestone bug-fix sync. Pulls the single new upstream commit
on chrome/m151 (a Use-After-Free fix in SubRunAllocator) into mono/skia's
skiasharp branch and advances the submodule pointer here.

- externals/skia submodule: 98877992a5 -> ff9099d996 (new merge commit)
- cgmanifest.json commitHash + upstream_merge_commit updated
- chrome_milestone unchanged (151)
- No version bump (CURRENT == TARGET == 151)
- No C API impact, zero binding diff, no C# code changes
- Native build (Linux x64) + full test suite (5614 passed, 0 failed) verified

Co-authored-by: Copilot <[email protected]>
@mattleibow mattleibow added the type/milestone-sync Any Skia upstream sync PR (milestone bump, same-milestone bug-fix re-sync, or tip sync). label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

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

PowerShell / Windows:

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

Step 2 — Add the local NuGet source

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

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

@mattleibow
mattleibow marked this pull request as ready for review July 10, 2026 20:42
mattleibow added a commit to mono/skia that referenced this pull request Jul 10, 2026
[skia-sync] Merge upstream chrome/m151 bug fixes (#282)

Upstream CL: https://skia-review.googlesource.com/c/skia/+/1288616
Original CL: https://skia-review.googlesource.com/c/skia/+/1284796
Bug: skia:530646115 / Chromium 532103445
Upstream commit: google/skia@0208108c7a (cherry-pick of 014a77e)

Merge one new bug-fix commit from chrome/m151 into the skiasharp branch:

  * 0208108 [M151] Fix Use-After-Free in SubRunAllocator

Deserializing a corrupt Slug buffer (SlugImpl::MakeFromBuffer) returns
nullptr early, destroying the temporary std::tuple result of
SubRunAllocator::AllocateClassMemoryAndArena. Because tuple member
destruction order is unspecified, SubRunInitializer freed the backing
memory before ~BagOfBytes in the SubRunAllocator read fEndByte from it
-- a use-after-free read followed by a wild-free/double-free.

Upstream replaces the tuple with a plain struct (AllocateAndArenaResult)
that declares the allocator so it is destroyed before the initializer
frees the memory, and moves SubRunInitializer onto a std::unique_ptr with
a custom deleter to make the ownership transfer explicit. This is the
same fix already merged to release/4.150.x in #281, now cherry-picked to
m151.

Internal C++ only: the single changed file is
src/text/gpu/SubRunAllocator.h. It touches no include/c or src/c file,
so there is no C API or SkiaSharp binding impact. Clean automatic merge,
no conflicts. Companion SkiaSharp PR: mono/SkiaSharp#4382.

Co-authored-by: Arthur Sonzogni <[email protected]>
mono/skia#282 was squash-merged into the skiasharp branch, so the
two-parent merge commit ff9099d996 no longer exists there. Point the
submodule and cgmanifest.json commitHash at the squash commit
cd6e926914 (current tip of mono/skia skiasharp).

chrome_milestone (151) and upstream_merge_commit (0208108c7a) are
unchanged -- no new upstream code was merged, only the mono/skia commit
SHA changed as a result of the squash.

Co-authored-by: Copilot App <[email protected]>
@mattleibow
mattleibow merged commit fe3b7a5 into main Jul 10, 2026
3 of 6 checks passed
@mattleibow
mattleibow deleted the skia-sync/m151 branch July 10, 2026 21:04
@mattleibow mattleibow added the partner/agentic-workflows Issues and PRs created by SkiaSharp agentic workflows. label Jul 11, 2026
mattleibow added a commit that referenced this pull request Jul 12, 2026
#4410)

Fix release-notes classifier that mis-tagged skia-sync PRs as internal (#4410)

The release-notes generator (scripts/infra/docs/release-notes-data.py) tags every
merged PR product / mixed / internal by the files it touched, so the Polish phase
can focus on product changes. Automated [skia-sync] submodule bumps — which change
the shipped native Skia — kept coming out `internal` and being dropped from the
notes (e.g. #4382 in 4.151.0-unreleased and #4262 in 4.148.1-unreleased were tagged
internal despite both bumping externals/skia).

~~ Root cause ~~

_files_by_commit() runs `git log --format=%x1e%H --name-only` and parsed each
record by matching a leading \x1e per line. But run() returns stdout.strip(), and
\x1e (the record separator) is whitespace to Python's str.strip(), so the leading
\x1e on the first record was stripped off. git log lists commits newest-first, so
that first, separator-less record is the newest commit in the range — very often
the latest [skia-sync] bump. The startswith("\x1e") check then missed it, its file
list was dropped, and an empty file set falls through to `internal`.

Parse by splitting on \x1e instead, which recovers every record regardless of the
stripped leading separator.

~~ Sharpen the path tiers ~~

While auditing which paths count as what:

  * product stays the strong signal — binding/ + source/ (managed API & Views) and
    externals/skia (the native Skia submodule, with its vendored HarfBuzz). The
    prefix is exact `externals/skia`, not `externals/`, so it no longer sweeps in
    the sibling externals/depot_tools build toolchain or externals/.gitignore.
  * native/ (per-platform build config) shapes the shipped binaries, so it is not
    internal, but a native/-only PR is usually infra rather than an API/behaviour
    change — so it is `mixed` (Polish judges from the title). Covers the shipped
    WinUI native subtree under native/winui/ too.
  * docs (the mono/SkiaSharp-API-docs submodule, mdoc XML that ships as IntelliSense
    docs) moves up from internal to `mixed`. A bump appears in the parent as the
    bare `docs` gitlink, so the prefix is slash-less and does not collide with
    documentation/ (the docs site, which stays internal).

~~ Make the mapping data-driven ~~

The path→tag mapping is no longer hardcoded in the script. It lives in the committed
scripts/infra/docs/release-notes-paths.json — ordered tiers (tag + patterns) plus a
default — the single deterministic place to edit it. _pr_category loads the tiers
(cached) and returns the first tier with a matching file, else the default. Patterns
match by prefix (str.startswith, unchanged behaviour) or, when they contain a glob
metacharacter (* ? [), by fnmatch.fnmatchcase — so paths, prefixes, and wildcards
are all supported. A missing/malformed config is a hard error, never a silent
fallback to a guessed mapping.

Behaviour is identical to the previous hardcoded tuples, verified across the prefix
cases and the real sync/docs/depot_tools PRs. Committed data.json files self-correct
as pages regenerate on the next prepare run; no data.json format bump. The behaviour
spec (documentation/dev/release-notes-and-api-diffs.md) and the release-notes SKILL.md
are updated to match, including the new config file in the inventory.

Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@mattleibow mattleibow added this to the 4.151.0-preview.2 milestone Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

partner/agentic-workflows Issues and PRs created by SkiaSharp agentic workflows. type/milestone-sync Any Skia upstream sync PR (milestone bump, same-milestone bug-fix re-sync, or tip sync).

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant