From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH] strip: Harden against bogus input files. Don't leak temp debug file on error.
Date: Fri, 15 May 2015 11:55:22 +0200 [thread overview]
Message-ID: <1431683722.3076.2.camel@bordewijk.wildebeest.org> (raw)
In-Reply-To: 1431439313-10184-1-git-send-email-mjw@redhat.com
[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]
On Tue, 2015-05-12 at 16:01 +0200, Mark Wielaard wrote:
> There were various places where a bogus/unexpected input file would cause
> eu-strip to crash. Also on an unexpected error eu-strip would leak the temp
> debug file it was writing.
After some more fuzzing another issue popped up. We should check
nbuckets isn't zero before using it.
diff --git a/src/strip.c b/src/strip.c
index 27c9927..d63b6a8 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1585,7 +1585,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
const char *name = elf_strptr (elf, strshndx,
sym->st_name);
- elf_assert (name != NULL);
+ elf_assert (name != NULL && nbucket != 0);
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
@@ -1647,7 +1647,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
const char *name = elf_strptr (elf, strshndx,
sym->st_name);
- elf_assert (name != NULL);
+ elf_assert (name != NULL && nbucket != 0);
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
Integrated into the existing patch and updated the mjw/pending branch.
Cheers,
Mark
next reply other threads:[~2015-05-15 9:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 9:55 Mark Wielaard [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-05-18 13:54 Mark Wielaard
2015-05-12 14:01 Mark Wielaard
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=1431683722.3076.2.camel@bordewijk.wildebeest.org \
--to=mjw@redhat.com \
--cc=elfutils-devel@lists.fedorahosted.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).