shaping: a debug client panics in swash on a non-flag regional-indicator pair #22
Labels
No labels
Area/ci
Area/cli
Area/client
Area/client-core
Area/daemon
Area/deps
Area/docs
Area/grid
Area/manual
Area/nix
Area/protocol
Area/pty
Area/render
Area/shaping
Area/skills
Area/transport
Area/vt
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Security
Kind/Testing
perf-regression-accepted
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Blocked
Status
Need More Info
Status
Upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
felis-terminal/felis#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A debug build of
felis-clientpanics as soon as it draws a regional-indicator pair that is not a real flag. swash 0.2.10 overflows a subtraction while applying a GSUB contextual lookup:Repro (debug build, Linux):
printf '🇦🇦'orprintf '🇯🇯'. A real flag such as🇯🇵does not panic. A release build does not panic either, because overflow checks are off; whatever swash does with the wrapped value then is unverified.Path:
felis_render_wgpu::glyphs::composite_cluster→felis_shaping::Shaper::shape_cluster→shape_run→swash::shape::Shaper::shape_with→at::apply→ApplyContext::apply_contextual→apply_nested→apply_uncached→apply_subtable(at.rs:1097). Which face was resolved for the cluster was not identified (config font: Moralerspace Neon HW, plus the system color-emoji fallback).🇦🇦is also a repro in #17, so this blocks verifying #17 on a debug build.Decide: check whether a newer swash fixes it upstream, and if not, guard the call (report upstream, and keep the client from dying on a shaping panic in debug).
Status: waiting on upstream swash; no felis-side guard.
mainstill has the panicking line:src/shape/at.rs,self.extend(seqlen - 1)in the multiple-substitution path. A GSUB rule that substitutes a glyph with an empty sequence makesseqlen0, so the subtraction underflows. This is most likely a rule in the color-emoji fallback face.Decision: felis does not wrap shaping in
catch_unwindor otherwise work around this. The panic only affects debug builds. Revisit when a swash release fixes it, or if a release build turns out to render these pairs wrong.