summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 15:56:27 -0300
committerGabriel Schneider <[email protected]>2026-11-23 16:28:34 -0300
commit8ee2339f0224000c48d23eca94e31d7c59fedd4c (patch)
treed3cbb8091675f678007efe5e092cbe60234cf740 /core
parent4640cef5f7237422b178122eea403858fcd560ea (diff)
downloadpardes-8ee2339f0224000c48d23eca94e31d7c59fedd4c.tar.gz
pardes-8ee2339f0224000c48d23eca94e31d7c59fedd4c.zip
notice band: a prompt's caret is counted wide and kept on the grid: a client's row metrics (a body cell far wider than a tagline glyph) make a band of 65535 glyphs (Layer.capacity's bound), whose caret x put `region.rect.x + caret.x` past u16 (core/draw.zig joinNotice: `integer overflow`, the session's render, found by the wire fuzz's session side on main); now counted in u32 and not drawn past the grid's columns; a user could not hit it with pardes's own frontends' metrics, a hostile or broken client could end the session
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
-rw-r--r--core/draw.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 8198e2ff..5263f7bf 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -279,7 +279,11 @@ fn joinNotice(p: *Pardes, s: *Surface, arena: std.mem.Allocator, region: Region)
// A notice wider than its band has less padding than the band hides.
for (skip..@max(skip, @min(pad, skip + chip))) |col| s.at(region.rect.x + @as(u16, @intCast(col - skip)), region.rect.y).style.fg = .default;
if (layer.cursor) |caret| {
- if (caret.x >= skip) s.cursor = .{ .x = region.rect.x + caret.x - @as(u16, @intCast(skip)), .y = region.rect.y, .bar = caret.bar };
+ // Counted wide: a band of 65535 glyphs (Layer.capacity's bound, which
+ // a frontend's row metrics reach) puts its caret past u16, and past
+ // the grid, where it is not drawn.
+ const x = @as(u32, region.rect.x) + caret.x;
+ if (caret.x >= skip and x - skip < s.cols) s.cursor = .{ .x = @intCast(x - skip), .y = region.rect.y, .bar = caret.bar };
}
}