1 --- binutils.orig/binutils/readelf.c 2022-10-03 13:20:42.707527855 +0100
2 +++ binutils-2.39/binutils/readelf.c 2022-10-03 13:21:25.785436781 +0100
3 @@ -6357,6 +6357,13 @@ get_32bit_section_headers (Filedata * fi
4 /* PR binutils/17531: Cope with unexpected section header sizes. */
5 if (size == 0 || num == 0)
8 + /* The section header cannot be at the start of the file - that is
9 + where the ELF file header is located. A file with absolutely no
10 + sections in it will use a shoff of 0. */
11 + if (filedata->file_header.e_shoff == 0)
14 if (size < sizeof * shdrs)
17 @@ -6421,6 +6428,12 @@ get_64bit_section_headers (Filedata * fi
18 if (size == 0 || num == 0)
21 + /* The section header cannot be at the start of the file - that is
22 + where the ELF file header is located. A file with absolutely no
23 + sections in it will use a shoff of 0. */
24 + if (filedata->file_header.e_shoff == 0)
27 if (size < sizeof * shdrs)