public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "mark at klomp dot org" <sourceware-bugzilla@sourceware.org>
To: elfutils-devel@sourceware.org
Subject: [Bug libelf/25069] AddressSanitizer: heap-buffer-overflow at libdwelf/dwelf_strtab.c:284
Date: Sat, 26 Oct 2019 20:07:00 -0000	[thread overview]
Message-ID: <bug-25069-10460-qX68zMRywc@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-25069-10460@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=25069

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-10-26
     Ever confirmed|0                           |1

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
Thanks, replicated with that reproducer (and the stripped file from the first)
with valgrind:

mark@librem:~/build/elfutils-obj$ LD_LIBRARY_PATH=backends:libelf:libdw:libasm
valgrind -q src/unstrip poc2/hbo__dwelf_strtab.c\:284_2 poc2/stripped -o
/dev/null
==22429== Invalid read of size 1
==22429==    at 0x4838C74: strlen (vg_replace_strmem.c:460)
==22429==    by 0x49B3EE3: dwelf_strtab_add (dwelf_strtab.c:284)
==22429==    by 0x11A8BE: copy_elided_sections (unstrip.c:1882)
==22429==    by 0x11CDA2: handle_file (unstrip.c:2203)
==22429==    by 0x11D10D: handle_explicit_files (unstrip.c:2268)
==22429==    by 0x1121CF: main (unstrip.c:2603)
==22429==  Address 0x5d8c3b5 is 0 bytes after a block of size 3,829 alloc'd
==22429==    at 0x483577F: malloc (vg_replace_malloc.c:299)
==22429==    by 0x4878E2D: __libelf_set_rawdata_wrlock (elf_getdata.c:332)
==22429==    by 0x4879B5C: __elf_getdata_rdlock (elf_getdata.c:535)
==22429==    by 0x4879B5C: __elf_getdata_rdlock (elf_getdata.c:458)
==22429==    by 0x4879C73: elf_getdata (elf_getdata.c:562)
==22429==    by 0x112B29: collect_symbols (unstrip.c:843)
==22429==    by 0x119B7D: copy_elided_sections (unstrip.c:1820)
==22429==    by 0x11CDA2: handle_file (unstrip.c:2203)
==22429==    by 0x11D10D: handle_explicit_files (unstrip.c:2268)
==22429==    by 0x1121CF: main (unstrip.c:2603)
==22429== 
==22429== Invalid read of size 1
==22429==    at 0x483D4E0: mempcpy (vg_replace_strmem.c:1536)
==22429==    by 0x49B3BD2: mempcpy (string_fortified.h:48)
==22429==    by 0x49B3BD2: copystrings (dwelf_strtab.c:301)
==22429==    by 0x49B400C: dwelf_strtab_finalize (dwelf_strtab.c:342)
==22429==    by 0x11AC4C: copy_elided_sections (unstrip.c:1929)
==22429==    by 0x11CDA2: handle_file (unstrip.c:2203)
==22429==    by 0x11D10D: handle_explicit_files (unstrip.c:2268)
==22429==    by 0x1121CF: main (unstrip.c:2603)
==22429==  Address 0x5d8c3b5 is 0 bytes after a block of size 3,829 alloc'd
==22429==    at 0x483577F: malloc (vg_replace_malloc.c:299)
==22429==    by 0x4878E2D: __libelf_set_rawdata_wrlock (elf_getdata.c:332)
==22429==    by 0x4879B5C: __elf_getdata_rdlock (elf_getdata.c:535)
==22429==    by 0x4879B5C: __elf_getdata_rdlock (elf_getdata.c:458)
==22429==    by 0x4879C73: elf_getdata (elf_getdata.c:562)
==22429==    by 0x112B29: collect_symbols (unstrip.c:843)
==22429==    by 0x119B7D: copy_elided_sections (unstrip.c:1820)
==22429==    by 0x11CDA2: handle_file (unstrip.c:2203)
==22429==    by 0x11D10D: handle_explicit_files (unstrip.c:2268)
==22429==    by 0x1121CF: main (unstrip.c:2603)
==22429== 
src/unstrip: cannot write output file: section `sh_size' too small for data

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2019-10-26 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-06 16:11 [Bug libelf/25069] New: " leftcopy.chx at gmail dot com
2019-10-26  0:57 ` [Bug libelf/25069] " mark at klomp dot org
2019-10-26  7:31 ` leftcopy.chx at gmail dot com
2019-10-26  8:07 ` leftcopy.chx at gmail dot com
2019-10-26 20:07 ` mark at klomp dot org [this message]
2019-10-26 20:52 ` [Bug tools/25069] " mark at klomp dot org
2019-10-29 14:49 ` mark at klomp dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-25069-10460-qX68zMRywc@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).