fix(ts-lsp): allocate tuple returns in arena#374
Conversation
|
Cross-linking from #381 — this PR fixes the same crash. Independent reproduction confirms it. Stack match: the ASan SEGV from your new Coverage analysis: I had hypothesized three candidate paths that could feed
One test, one reachable path, full coverage. I drafted a 3-element variant locally to verify, and it exercises identical bytecode (the NULL arena is dereffed before Optimization sensitivity (FYI — explains why this only surfaced now): the bug is opt-level dependent on
That's why CI hadn't caught it — Small heads-up on The |
- cbm_arena_alloc returns NULL on a NULL arena (both arena.c copies) instead of dereferencing it — defense-in-depth against the NULL-arena type-allocation path that could crash the LSP type layer. - discover: add "vendored" to the always-skip directory list. Distilled from #374, taking the parts not already on main. The PR's ts_lsp tuple-arena allocation, the C/C++ template formal-count clamp, and the type_rep unbound-param preservation it also carried all landed independently in v0.7.0 / via #322 / #360, so only these two defensive improvements remain. Relates to #390.
|
Thank you, @casualjim! 🙏 And thank you for your honesty in the description — that candor actually helped me triage this well. You were chasing real segfaults, and the good news is that most of what you fixed has since landed on main independently, so you were on exactly the right track:
So the segfaults you reproduced on Mac and Linux should be gone on current Two genuinely-new improvements from your PR weren't on main, so I distilled them in and credited you as author (9e2bb92): the I intentionally left out two things: |
I don't know if this is the right fix. But when I tried to follow main I'd end up with segfaults.
I could reproduce this in mac and linux host, this stops those segfaults.