]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
elf: Don't read beyond .eh_frame section end
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 30 Sep 2025 00:39:34 +0000 (08:39 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 1 Oct 2025 02:08:01 +0000 (10:08 +0800)
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>
bfd/elf-eh-frame.c

index 30bb313489c6e71a0170cd2687b5fe66044aeb67..4eda3c991bb495b40bdcae679295a85824a16c53 100644 (file)
@@ -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')