diff --git a/main.cpp b/main.cpp index f8cb041..13eb37a 100644 --- a/main.cpp +++ b/main.cpp @@ -165,7 +165,8 @@ void parse_debuginfo_section(const void *file) uint64_t code; fprintf(stdout, ".debug_info offset for first DIE: %#x\n", ((uint64_t)p - (uint64_t)file)); // TODO: 32bit size - for (; ((uint64_t)p - (uint64_t)cuh) < cuh->unit_length - 12;) + // TODO: unit_length is supposed to be 4/12 Bytes + for (; ((uint64_t)p - (uint64_t)cuh) < cuh->unit_length + sizeof(compilation_unit_header_t) - 12;) { p += decode_leb128((uint8_t*)p, &code);