fix(c_lsp): remove the whole-function ASan suppression; assert the resolution it hid

c_lsp_process_file carried __attribute__((no_sanitize("address"))) over the
entire C LSP orchestration, excluding every direct memory access in it from
ASan -- placed for a stack-pointer-to-registry lifetime bug whose witness test
also had its assertion discarded ((void)find_resolved), so nothing could ever
prove the bug gone. Flagged by the memory-diagnostics standards report
(private/C_MEMORY_DIAGNOSTICS_STANDARDS_REPORT.md, priority 2) as the single
highest-value ASan coverage gap in the repository.

This branch's C LSP registry rework resolved the underlying lifetime: with the
suppression removed, the full c_lsp suite passes under ASan+UBSan (760 tests),
including the formerly-failing template field type resolution, whose test now
asserts the resolved call instead of discarding it.

Honest limit: the original bug predates the branch and its fix is the branch's
broad registry rework, not an isolatable commit -- so the revert-proof is
main-vs-branch (main: suppression + discarded assertion; branch: neither),
not a single-change revert-check.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel committed 2026-08-03 01:47:35 +02:00
1 parent e2f5b6a798
commit 679871aedb
2 files changed
+8 -6

No files matched your search

+1 -1
View File
@@ -5402,7 +5402,7 @@ static void c_process_class(CLSPContext *ctx, TSNode class_node) {
// Process file: top-level walk
// ============================================================================
__attribute__((no_sanitize("address"))) void c_lsp_process_file(CLSPContext *ctx, TSNode root) {
void c_lsp_process_file(CLSPContext *ctx, TSNode root) {
if (ts_node_is_null(root))
return;
+7 -5
View File
@@ -7795,11 +7795,13 @@ TEST(clsp_fix2_struct_field_access_pair_second) {
"}\n"
"");
ASSERT_NOT_NULL(r);
/* KNOWN ISSUE: template field type resolution fails under ASan due to
* a stack-pointer-to-registry leak bug in c_lsp.c. The Go test passes
* because CGo doesn't run ASan/UBSan. See c_lsp_process_file's
* no_sanitize("address") attribute. Tracked as a pre-existing C LSP bug. */
(void)find_resolved(r, "test", "bar");
/* Formerly a KNOWN ISSUE: template field type resolution failed under
* ASan due to a stack-pointer-to-registry lifetime bug, hidden by a
* whole-function no_sanitize("address") on c_lsp_process_file and a
* discarded assertion here. The suppression is removed and the branch's
* C LSP registry rework resolved the lifetime; this now asserts the
* resolution it always meant to. */
ASSERT_GTE(find_resolved(r, "test", "bar"), 0);
cbm_free_result(r);
PASS();
}