szn

Bug 263 — Attempting to Free Static Slice in findWordBreaks

263. Attempting to Free Static Slice in findWordBreaks

File: src/thai.zig:532–547 Severity: HIGH Status: ✅ FIXED — all three static &[_]usize{} returns replaced with allocator.alloc(usize, 0). Unit test added.

When codepoints.items.len == 0 or num_breaks <= 0, findWordBreaks returns a pointer to a static empty slice literal &[_]usize{}. Callers (e.g. word navigation in mode_copy.zig) assume the returned slice is owned and call allocator.free(breaks).

Impact: Immediate allocator panic in Debug/ReleaseSafe builds; memory corrupting undefined behavior in ReleaseFast builds.