[binutils-gdb] elf: Don't read beyond .eh_frame section end

H.J. Lu hjl@sourceware.org
Wed Oct 1 02:08:48 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e4f355f13be7fd4b165fe3ec3349ece972db05db

commit e4f355f13be7fd4b165fe3ec3349ece972db05db
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 30 08:39:34 2025 +0800

    elf: Don't read beyond .eh_frame section end
    
            PR ld/33500
            * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't read beyond
            the .eh_frame section end.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 bfd/elf-eh-frame.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 30bb313489c..4eda3c991bb 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -761,6 +761,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
 
 	  strcpy (cie->augmentation, (char *) buf);
 	  buf = (bfd_byte *) null_byte + 1;
+	  REQUIRE (buf + 1 < end);
 	  this_inf->u.cie.aug_str_len = buf - start - 1;
 	  ENSURE_NO_RELOCS (buf);
 	  if (buf[0] == 'e' && buf[1] == 'h')


More information about the Binutils-cvs mailing list