]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Fix __libdw_read_offset size in dwarf_getpubnames.c get_offsets
authorMark Wielaard <mark@klomp.org>
Sun, 12 Jul 2026 12:07:05 +0000 (14:07 +0200)
committerMark Wielaard <mark@klomp.org>
Sun, 12 Jul 2026 12:07:12 +0000 (14:07 +0200)
There was a typo in the __libdw_read_offset call that meant it only
checked there were 3 bytes available in .debug_info at the given
offset instead of 4. This could result in a 1 byte overread.

* libdw/dwarf_getpubnames.c (get_offsets): Call
__libdw_read_offset with size 4.

https://sourceware.org/bugzilla/show_bug.cgi?id=34392

Reported-by: Karan Kurani <karankurani3k@gmail.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
libdw/dwarf_getpubnames.c

index de726407c07959db32a6c21bc6e6e704028b6854..94e624b27ed467ae0b517450dbaeeba6afcf4906 100644 (file)
@@ -105,7 +105,7 @@ get_offsets (Dwarf *dbg)
       /* Get the CU offset.  */
       if (__libdw_read_offset (dbg, dbg, IDX_debug_pubnames,
                               readp + 2, len_bytes,
-                              &mem[cnt].cu_offset, IDX_debug_info, 3))
+                              &mem[cnt].cu_offset, IDX_debug_info, 4))
        /* Error has been already set in reader.  */
        goto err_return;