Skip to content

deps: bump typesetting past the CFF2 INDEX allocation bug - #845

Closed
felix-dumit wants to merge 2 commits into
tomasz-tomczyk:mainfrom
felix-dumit:deps/bump-typesetting-cff2-fix
Closed

felix-dumit wants to merge 2 commits into
tomasz-tomczyk:mainfrom
felix-dumit:deps/bump-typesetting-cff2-fix

Conversation

@felix-dumit

@felix-dumit felix-dumit commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Why

/api/code-fonts parses every font on the system. On macOS one of them,
/System/Library/Fonts/SFIndia.ttc, makes typesetting v0.3.4 allocate tens of
GB before panicking — its CFF2 INDEX parser sizes a slice from an unvalidated
uint32 count.

safelyInspectCodeFont recovers the panic, so discovery returns normally and
nothing is logged. The allocation still happened, and Go does not hand it back
on Darwin. A _serve process after one Settings open went 7.6 GB → 2.5 GB and
stayed at 2.5 GB for the rest of its life.

Full system font scan (TestDiscoverCodeFontFamiliesScansTheCurrentSystem):

peak RSS
v0.3.4 ~14.9 GB
this PR 469 MB

What

Bumps typesetting to a pseudo-version off upstream main, which carries the fix
(go-text/typesetting 9e0086e and 4b2141b). No tagged release has it yet —
v0.3.4 predates both. Worth swapping for a normal version tag once upstream
cuts one.

go-text/typesetting#267

Testing

go build ./... and go test ./internal/server/ both clean.

/api/code-fonts parses every system font. On macOS, SFIndia.ttc makes
typesetting v0.3.4 allocate tens of GB before panicking: its CFF2 INDEX
parser sizes a slice from an unvalidated uint32 count.

safelyInspectCodeFont recovers the panic, so discovery still returns and
nothing is logged, but the allocation already happened and Go does not
give it back on Darwin. A _serve process after one Settings open went
7.6 GB -> 2.5 GB and held there for the rest of its life.

A full system font scan drops from ~14.9 GB peak RSS to 469 MB.

Upstream fixed this in 9e0086e and 4b2141b, which are on main but not in
any tagged release, so this points at a pseudo-version until they tag.
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.86%. Comparing base (b81febd) to head (6acf2e6).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #845      +/-   ##
==========================================
+ Coverage   73.51%   75.86%   +2.35%     
==========================================
  Files         154      161       +7     
  Lines       21448    21582     +134     
==========================================
+ Hits        15768    16374     +606     
+ Misses       4369     3892     -477     
- Partials     1311     1316       +5     
Flag Coverage Δ
e2e 27.08% <ø> (?)
unit 73.53% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk

Copy link
Copy Markdown
Owner

I was wondering why my terminals kept going OOM!!! Took me a while to arrive at this same thing. Wish you undrafted this a while ago! 😆

@tomasz-tomczyk

Copy link
Copy Markdown
Owner

Closing in favor of #897, which contains the same typesetting bump rebased on current main and includes the updated Nix vendorHash. This branch is stale and its diff currently reverts the defense-in-depth guards added in #895.

@felix-dumit

Copy link
Copy Markdown
Contributor Author

I was wondering why my terminals kept going OOM!!! Took me a while to arrive at this same thing. Wish you undrafted this a while ago! 😆

Yeah I went down a deep rabbit hole to find this 😅, I was waiting to see if upstream would release a new version, but thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants