Skip to content

Commit 033c1e0

Browse files
committed
fix(lsp): skip unnamed funcs in the unindexed QN lookup
lookup_func_self guards a NULL qualified_name in its indexed bucket scan and its post-finalize tail scan, but not in the linear scan an unfinalized registry takes. Iterating a fallback chain checks every base entry for shadowing against the head, so a head holding a func without a qualified name crashed in strcmp (ASan SEGV in pylsp_prefix_order_matches_iterator_and_chain_shadowing). The linear scan now skips such entries like the other two. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 23e2910 commit 033c1e0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎internal/cbm/lsp/type_registry.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ static const CBMRegisteredFunc *lookup_func_self(const CBMTypeRegistry *reg,
909909

910910
for (int i = 0; i < reg->func_count; i++) {
911911
CBM_LSP_WORK(1);
912-
if (strcmp(reg->funcs[i].qualified_name, qualified_name) == 0) {
912+
if (reg->funcs[i].qualified_name &&
913+
strcmp(reg->funcs[i].qualified_name, qualified_name) == 0) {
913914
return &reg->funcs[i];
914915
}
915916
}

0 commit comments

Comments
 (0)