Fix readelf's decoding of files with no sections. (#2131609)
This commit is contained in:
parent
dd133b6b81
commit
e27610f6a7
29
binutils-readelf-no-sections.patch
Normal file
29
binutils-readelf-no-sections.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
--- binutils.orig/binutils/readelf.c 2022-10-03 13:20:42.707527855 +0100
|
||||||
|
+++ binutils-2.39/binutils/readelf.c 2022-10-03 13:21:25.785436781 +0100
|
||||||
|
@@ -6357,6 +6357,13 @@ get_32bit_section_headers (Filedata * fi
|
||||||
|
/* PR binutils/17531: Cope with unexpected section header sizes. */
|
||||||
|
if (size == 0 || num == 0)
|
||||||
|
return false;
|
||||||
|
+
|
||||||
|
+ /* The section header cannot be at the start of the file - that is
|
||||||
|
+ where the ELF file header is located. A file with absolutely no
|
||||||
|
+ sections in it will use a shoff of 0. */
|
||||||
|
+ if (filedata->file_header.e_shoff == 0)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
if (size < sizeof * shdrs)
|
||||||
|
{
|
||||||
|
if (! probe)
|
||||||
|
@@ -6421,6 +6428,12 @@ get_64bit_section_headers (Filedata * fi
|
||||||
|
if (size == 0 || num == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
+ /* The section header cannot be at the start of the file - that is
|
||||||
|
+ where the ELF file header is located. A file with absolutely no
|
||||||
|
+ sections in it will use a shoff of 0. */
|
||||||
|
+ if (filedata->file_header.e_shoff == 0)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
if (size < sizeof * shdrs)
|
||||||
|
{
|
||||||
|
if (! probe)
|
@ -39,7 +39,7 @@
|
|||||||
Summary: A GNU collection of binary utilities
|
Summary: A GNU collection of binary utilities
|
||||||
Name: binutils%{?name_cross}%{?_with_debug:-debug}
|
Name: binutils%{?name_cross}%{?_with_debug:-debug}
|
||||||
Version: 2.39
|
Version: 2.39
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: https://sourceware.org/binutils
|
URL: https://sourceware.org/binutils
|
||||||
|
|
||||||
@ -303,6 +303,10 @@ Patch20: binutils-gas-dwarf-skip-empty-functions.patch
|
|||||||
# Lifetime: Fixed in 2.40
|
# Lifetime: Fixed in 2.40
|
||||||
Patch21: binutils-CVE-38128-dwarf-abbrev-parsing.patch
|
Patch21: binutils-CVE-38128-dwarf-abbrev-parsing.patch
|
||||||
|
|
||||||
|
# Purpose: Stop readelf from incorrectly decoding ELF files with no sections.
|
||||||
|
# Lifetime: Fixed in 2.40
|
||||||
|
Patch22: binutils-readelf-no-sections.patch
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
Provides: bundled(libiberty)
|
Provides: bundled(libiberty)
|
||||||
@ -959,6 +963,9 @@ exit 0
|
|||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 03 2022 Nick Clifton <nickc@redhat.com> - 2.39-4
|
||||||
|
- Fix readelf's decoding of files with no sections. (#2131609)
|
||||||
|
|
||||||
* Wed Aug 31 2022 Nick Clifton <nickc@redhat.com> - 2.39-3
|
* Wed Aug 31 2022 Nick Clifton <nickc@redhat.com> - 2.39-3
|
||||||
- Stop a potential infinite loop in the binutils DWARF parser. (#2122675)
|
- Stop a potential infinite loop in the binutils DWARF parser. (#2122675)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user