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/24085] An Out of Memory problem was discovered in function in read_long_names in elf_begin.c in libelf
Date: Tue, 15 Jan 2019 14:09:00 -0000	[thread overview]
Message-ID: <bug-24085-10460-vuWwNw6yOY@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-24085-10460@http.sourceware.org/bugzilla/>

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
I am not sure this is a real issue. The read_long_names code does the
following:

  newp = (char *) malloc (len);
  if (newp != NULL)

And if it is newp NULL is returned, which is then interpreted as an error:

              /* No long name table although it is reference.  The archive is
                 broken.  */
              __libelf_seterrno (ELF_E_INVALID_ARCHIVE);
              return -1;

There are also checks that no more data is read than there is in the file, so
if len is really big and malloc still succeeds that is also flagged as a
corrupt file.

So, yeah, a malloc call might fail on an invalid file, but nothing bad will
happen.

If you do feel it is an issue. We could move up the size checks, so no malloc
is done at all if len is really weird and we know the malloc would probably
fail anyway.

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

  parent reply	other threads:[~2019-01-15 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11  6:27 [Bug libelf/24085] New: " wcventure at 126 dot com
2019-01-11  6:34 ` [Bug libelf/24085] " wcventure at 126 dot com
2019-01-15 14:09 ` mark at klomp dot org [this message]
2019-02-08  0:40 ` mark at klomp dot org
2019-02-14 10:51 ` 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-24085-10460-vuWwNw6yOY@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).