[PATCH] Don't crash on DWARF5 .debug_line table with zero files.
Mark Wielaard
mark@klomp.org
Fri Jan 22 12:40:47 GMT 2021
Not having any files in a DWARF5 .debug_line table is odd, but not
technically invalid. Normally there should be a zero file entry that
is equal to the compile unit main file (there is no such zero entry
for early DWARF versions and we handle no file entries fine in that
case).
https://bugzilla.redhat.com/show_bug.cgi?id=1919243
---
dwz.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dwz.c b/dwz.c
index 53b9548..28f0c4d 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1839,7 +1839,8 @@ read_debug_line (DSO *dso, dw_cu_ref cu, uint32_t off)
}
nfiles = read_uleb128 (ptr);
- nfiles--; /* We will skip the first (zero) entry. */
+ if (nfiles > 0)
+ nfiles--; /* We will skip the first (zero) entry. */
}
cu->cu_nfiles = nfiles;
--
2.18.4
More information about the Dwz
mailing list