public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] asan: elf.c:12621:18: applying zero offset to null pointer
@ 2022-12-17  8:15 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-12-17  8:15 UTC (permalink / raw)
  To: bfd-cvs

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

commit 6f00d50e2b6445f88b5f362dbbd982f387b6354f
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Dec 16 18:13:38 2022 +1030

    asan: elf.c:12621:18: applying zero offset to null pointer
    
    That's this line in elf_parse_notes:
      while (p < buf + size)
    
            * elf.c (_bfd_elf_make_section_from_shdr): Don't call
            elf_parse_notes when sh_size is zero.

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

diff --git a/bfd/elf.c b/bfd/elf.c
index 5548efc44e4..7317c52faaa 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1110,7 +1110,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
   /* We do not parse the PT_NOTE segments as we are interested even in the
      separate debug info files which may have the segments offsets corrupted.
      PT_NOTEs from the core files are currently not parsed using BFD.  */
-  if (hdr->sh_type == SHT_NOTE)
+  if (hdr->sh_type == SHT_NOTE && hdr->sh_size != 0)
     {
       bfd_byte *contents;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-17  8:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17  8:15 [binutils-gdb] asan: elf.c:12621:18: applying zero offset to null pointer Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).