Merge pull request #234152 from henrirosten/fix_CVE-2023-1972

This commit is contained in:
Bernardo Meurer 2023-05-26 17:05:39 +01:00 committed by GitHub
commit 2a1c962281
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,23 @@
diff --git a/bfd/elf.c b/bfd/elf.c
index 027d0143735..185028cbd97 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9030,6 +9030,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return_verdef;
}
+
+ if (amt == 0)
+ goto error_return_verdef;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return_verdef;
@@ -9133,6 +9136,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return;
}
+ if (amt == 0)
+ goto error_return;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;

View file

@ -88,6 +88,10 @@ stdenv.mkDerivation (finalAttrs: {
# not need to know binutils' BINDIR at all. It's an absolute path
# where libraries are stored.
./plugins-no-BINDIR.patch
# CVE-2023-1972 fix to bfd/elf.c from:
# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57
./CVE-2023-1972.patch
]
++ lib.optional targetPlatform.isiOS ./support-ios.patch
# Adds AVR-specific options to "size" for compatibility with Atmel's downstream distribution