fix: use correct amount of bytes in guard of DIE read loop

This commit is contained in:
Phireh 2023-09-23 22:01:35 +02:00
commit 49d52061f7
Signed by: Phireh
GPG key ID: DD169F1BA658A5E5

View file

@ -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);