diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 01:18:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | e6e81a6bc544c5ab5a47c21d85e6868020031abb (patch) | |
| tree | a2a9947d01ba0e6b1d36ccf4020816d2e0c6ca61 /build.zig | |
| parent | 65612a1cc13dd2a7e866f88176dbf6db5dd83467 (diff) | |
| download | pardes-e6e81a6bc544c5ab5a47c21d85e6868020031abb.tar.gz pardes-e6e81a6bc544c5ab5a47c21d85e6868020031abb.zip | |
regexp: a class's range may end at \xff: mvzr counted `c1..c2 + 1` in a u8, which overflowed at 0xff (a panic in a safe build, a loop past its bounds in a fast one), so `[\x80-\xff]` in any search, an address, s or S, a plumbing rule, took the editor down; build.zig's patch of mvzr widens the count to usize, beside its other patches (one occurrence, checked); found writing the plumber's rules, whose classes for UTF-8 names the design record wrote as \x80-\xff; test: a class of a-z and the high bytes finds café, [\xff-\xff] compiles; the changelog says so
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -400,7 +400,11 @@ pub fn build(b: *std.Build) void { if (std.mem.count(u8, backed, end_anchor) != 1) @panic("mvzr's parser changed: redo its `$` before `|` in build.zig"); var patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); // Zig 0.17 removed `**`; mvzr still has it (its PR #16 replaces it upstream). + // A class's range ending at `\xff` counted to 256 in a u8, an + // overflow (a panic in a safe build, a runaway loop in a fast one): + // `[\x80-\xff]` in any search took the editor down. for ([_][3][]const u8{ + .{ "for (c1..c2 + 1) |c_range|", "for (c1..@as(usize, c2) + 1) |c_range|", "1" }, .{ "[1]RegOp{.{ .unused = {} }} ** ops", "@splat(.{ .unused = {} })", "1" }, .{ "[1]CharSet{.{ .low = 0, .hi = 0 }} ** char_sets", "@splat(.{ .low = 0, .hi = 0 })", "1" }, .{ "\"a\" ** 2048", "&@as([2048]u8, @splat('a'))", "2" }, |
