From a6dd529dd5987e0164d0d3348df101359998be10 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Thu, 19 Feb 2026 18:10:04 -0800 Subject: [PATCH] explicitly handle null terminator in abbrev parse --- src/dwarf/dwarf_parse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dwarf/dwarf_parse.c b/src/dwarf/dwarf_parse.c index c6f603b6..bdaae721 100644 --- a/src/dwarf/dwarf_parse.c +++ b/src/dwarf/dwarf_parse.c @@ -452,8 +452,17 @@ dw_read_abbrev_tag(String8 data, U64 offset, DW_Abbrev *out_abbrev) U64 cursor = offset; // read tag ID and kind - U64 id, kind; + U64 id = 0; TryRead(str8_deserial_read_uleb128(data, cursor, &id), cursor, exit); + + // is this null terminator? + if (id == 0) { + total_bytes_read = cursor - offset; + MemoryZeroStruct(out_abbrev); + goto exit; + } + + U64 kind = 0; TryRead(str8_deserial_read_uleb128(data, cursor, &kind), cursor, exit); // read child flag