Skip to content

fix: ReleaseFast crash — avoid LLVM codegen bugs with large tagged unions#99

Merged
loyalpartner merged 1 commit intomainfrom
fix/crash
Apr 2, 2026
Merged

fix: ReleaseFast crash — avoid LLVM codegen bugs with large tagged unions#99
loyalpartner merged 1 commit intomainfrom
fix/crash

Conversation

@loyalpartner
Copy link
Copy Markdown
Owner

Summary

  • Fix SIGSEGV crashes in ReleaseFast builds caused by LLVM miscompiling large tagged union (?std.json.Value) value copies through ArrayList/Queue, and error union returns from functions with C FFI calls
  • Fix VimChannel stack UAF in serveStdio/serveTcpOnce
  • Fix highlight flash-then-disappear on file open
  • Add --no-copilot CLI flag and g:yac_copilot_enabled Vim option

Changes

Notification pipelineOwnedNotification stores params_json: ?[]const u8 (pre-serialized) instead of ?std.json.Value to avoid LLVM codegen bugs with large tagged union value copies

consumeLoop — Pre-encode params before group.concurrent capture; handlers decode from []const u8

Tree-sitter handlergetHighlights, extractHighlights, openBufferSafe marked noinline; openBufferSafe uses version comparison instead of error union return; @errorName replaced with safeErrorName (noinline + bounds check); added Io.Mutex for concurrent access; onEdit skips highlight push when content unchanged

VimChannel — Heap-allocated in serveStdio/serveTcpOnce to fix stack UAF

Outbound write — Index-based iteration instead of value copy to fix LLVM slice .len corruption

Copilot--no-copilot flag, g:yac_copilot_enabled option, daemon tests skip copilot

Test inframaxprocesses=12, test_md_inline skipped (pre-existing timing issue)

Test plan

  • zig build test — 106 unit tests pass
  • make test-parallel — 76 pass, 0 fail, 6 skipped
  • 0 coredumps across 3 consecutive ReleaseFast parallel runs
  • Manual: open CLAUDE.md + agents.md, highlights persist
  • Manual: :YacRestart preserves functionality

🤖 Generated with Claude Code

…ions

LLVM in ReleaseFast miscompiles functions containing C FFI calls when
large tagged unions (?std.json.Value) are copied by value through
ArrayList/Queue, or when such functions are inlined into 8000+ byte
mega-functions.

Notification pipeline:
- OwnedNotification stores params_json: ?[]const u8 instead of
  ?std.json.Value — serialized in dispatchLoop, re-parsed by consumers
- consumeLoop pre-encodes params before group.concurrent capture
- OnNotification callback signature changed to pass []const u8

Tree-sitter handler:
- getHighlights, extractHighlights, openBufferSafe marked noinline
- @Errorname(err) replaced with safeErrorName (noinline + bounds check)
- Added Io.Mutex for concurrent onOpen/onEdit/onViewport/onClose

VimChannel UAF:
- serveStdio/serveTcpOnce heap-allocate ch instead of stack-local

Copilot opt-out:
- --no-copilot CLI flag, g:yac_copilot_enabled Vim option
- Daemon tests pass --no-copilot to skip copilot-language-server

Test infra:
- Parallel test maxprocesses reduced from 38 to 12
- Makefile release target switched to ReleaseFast
@loyalpartner loyalpartner merged commit 2c8306b into main Apr 2, 2026
2 of 4 checks passed
@loyalpartner loyalpartner deleted the fix/crash branch April 2, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant