From bcf248682caa12864cabe6c70a63a00192104e81 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Fri, 8 May 2026 01:25:42 -0700 Subject: [PATCH] guard against relative path nodes --- src/radbin/radbin.c | 4 ++-- src/rdi/rdi_local.c | 4 +++- src/rdi_from_dwarf/rdi_from_dwarf.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/radbin/radbin.c b/src/radbin/radbin.c index ce798280..1704ddef 100644 --- a/src/radbin/radbin.c +++ b/src/radbin/radbin.c @@ -1243,7 +1243,7 @@ rb_thread_entry_point(void *p) } PathStyle path_style = PathStyle_SystemAbsolute; if (str8_match_wildcard(top_part, str8_lit("?:"), 0)) { path_style = PathStyle_WindowsAbsolute; } - else if(str8_match(top_part, str8_lit("/"), 0)) { path_style = PathStyle_UnixAbsolute; } + else if(str8_match_wildcard(top_part, str8_lit("/*"), 0)) { path_style = PathStyle_UnixAbsolute; } String8 path = str8_from_rdi_path_node_idx(scratch.arena, rdi, path_style, src_file->file_path_node_idx); str8_list_pushf(arena, &output_blobs, "[inlined] %S %S:%u\n", inline_name, path, inline_line.line_num); @@ -1266,7 +1266,7 @@ rb_thread_entry_point(void *p) } PathStyle path_style = PathStyle_SystemAbsolute; if (str8_match_wildcard(top_part, str8_lit("?:"), 0)) { path_style = PathStyle_WindowsAbsolute; } - else if(str8_match(top_part, str8_lit("/"), 0)) { path_style = PathStyle_UnixAbsolute; } + else if(str8_match_wildcard(top_part, str8_lit("/*"), 0)) { path_style = PathStyle_UnixAbsolute; } String8 path = str8_from_rdi_path_node_idx(scratch.arena, rdi, path_style, src_file->file_path_node_idx); str8_list_pushf(arena, &output_blobs, "%S:%u\n", path, line.line_num); diff --git a/src/rdi/rdi_local.c b/src/rdi/rdi_local.c index b575ea3e..d99f00be 100644 --- a/src/rdi/rdi_local.c +++ b/src/rdi/rdi_local.c @@ -61,7 +61,9 @@ str8_from_rdi_path_node_idx(Arena *arena, RDI_Parsed *rdi, PathStyle path_style, { String8 path_part = {0}; path_part.str = rdi_string_from_idx(rdi, fpn->name_string_idx, &path_part.size); - str8_list_push_front(scratch.arena, &path_parts, path_part); + String8List s = str8_split_path(scratch.arena, path_part); + str8_list_concat_in_place(&s, &path_parts); + path_parts = s; } String8 path = str8_path_list_join_by_style(arena, &path_parts, path_style); scratch_end(scratch); diff --git a/src/rdi_from_dwarf/rdi_from_dwarf.c b/src/rdi_from_dwarf/rdi_from_dwarf.c index 36fd2e51..30315302 100644 --- a/src/rdi_from_dwarf/rdi_from_dwarf.c +++ b/src/rdi_from_dwarf/rdi_from_dwarf.c @@ -2862,8 +2862,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params) String8 path; { Temp temp = temp_begin(scratch.arena); - PathStyle path_style = PathStyle_Null; - path_style = path_style_from_str8(lookup->vm->header.dir_table.v[src->dir_idx]); + PathStyle path_style = path_style_from_str8(lookup->vm->header.dir_table.v[src->dir_idx]); if (path_style == PathStyle_Relative) { path_style = path_style_from_str8(src->path); }