render: placed glyph slots are bounded only by the atlas filling #451

Closed
opened 2026-09-25 13:37:11 +09:00 by natsukium · 0 comments
Owner

GlyphIndex::slots (crates/felis-render-wgpu/src/glyphs.rs) keeps one entry per placed glyph key, and that map is emptied only when the atlas recycles. PR #450 (#406) capped the blank entries, which take no atlas space. Placed entries are still bounded only by how many glyphs fit in an atlas sheet before it fills.

Failure scenario. A producer can emit OSC 66 runs at many tiny fractional scales, so each char × sizing × style key rasterizes to a 1–2 px glyph. A 2048² sheet then holds a few million placed entries before a recycle frees them. The slot map and the matching ShapeCache entries grow to that size from PTY output alone. The ShapeCache side is already bounded by the byte cap after #450.

Done when:

  • the slot map has a bound on the entry count that does not depend on glyph size, for example by recycling the atlas, or evicting, once placed entries pass a cap;
  • the hit path stays as it is;
  • a test drives distinct tiny placed glyphs past the cap and shows the map stays under it;
  • docs/explanation/security-model.md "Resource exhaustion" and the atlas section of docs/explanation/rendering/pipeline.md state the bound.

Refs #406, #450.

`GlyphIndex::slots` (`crates/felis-render-wgpu/src/glyphs.rs`) keeps one entry per placed glyph key, and that map is emptied only when the atlas recycles. PR #450 (#406) capped the blank entries, which take no atlas space. Placed entries are still bounded only by how many glyphs fit in an atlas sheet before it fills. **Failure scenario.** A producer can emit OSC 66 runs at many tiny fractional scales, so each char × sizing × style key rasterizes to a 1–2 px glyph. A 2048² sheet then holds a few million placed entries before a recycle frees them. The slot map and the matching `ShapeCache` entries grow to that size from PTY output alone. The `ShapeCache` side is already bounded by the byte cap after #450. **Done when:** - the slot map has a bound on the entry count that does not depend on glyph size, for example by recycling the atlas, or evicting, once placed entries pass a cap; - the hit path stays as it is; - a test drives distinct tiny placed glyphs past the cap and shows the map stays under it; - `docs/explanation/security-model.md` "Resource exhaustion" and the atlas section of `docs/explanation/rendering/pipeline.md` state the bound. Refs #406, #450.
Commenting is not possible because the repository is archived.
No description provided.