]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Allow .gdb_index const table to be empty
authorMark Wielaard <mark@klomp.org>
Sat, 7 Sep 2024 22:00:05 +0000 (00:00 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 10 Sep 2024 16:04:14 +0000 (18:04 +0200)
The .gdb_index const table can be empty, if no symbol table entry
refers to a name or CU. Which technically means the symbol table is
empty or has only zero members.

      * src/readelf.c (print_gdb_index_section): Check const_off is
      not past the end of the data section, it can be at the end.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/readelf.c

index 8d96443daa836832b970c645d016e171bb9780de..21cacd7b6c06ce368e4c88403e7399754996e139 100644 (file)
@@ -11679,7 +11679,7 @@ print_gdb_index_section (Dwfl_Module *dwflmod, Ebl *ebl,
     }
 
   const unsigned char *const_start = data->d_buf + const_off;
-  if (const_off >= data->d_size)
+  if (const_off > data->d_size)
     goto invalid_data;
 
   const unsigned char *shortcut_start = NULL;