public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: [PATCH] elflint: Stop checking section when 2nd hash function shift too big.
Date: Wed, 06 May 2015 13:10:45 +0200	[thread overview]
Message-ID: <1430910645-16816-1-git-send-email-mjw@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]

Nothing good comes from trying to continue with a bogus hash function.

https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c31
---
 src/ChangeLog | 5 +++++
 src/elflint.c | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 7a44fc6..486f20f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-06  Mark Wielaard  <mjw@redhat.com>
+
+	* elflint.c (check_gnu_hash): Return early when 2nd hash function
+	shift too big.
+
 2015-05-05  Mark Wielaard  <mjw@redhat.com>
 
 	* nm.c (show_symbols): Handle dwarf_linesrc returning NULL.
diff --git a/src/elflint.c b/src/elflint.c
index a6f9b68..3abda71 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -2115,9 +2115,12 @@ section [%2d] '%s': hash table section is too small (is %ld, expected at least %
     }
 
   if (shift > 31)
-    ERROR (gettext ("\
+    {
+      ERROR (gettext ("\
 section [%2d] '%s': 2nd hash function shift too big: %u\n"),
-	   idx, section_name (ebl, idx), shift);
+	     idx, section_name (ebl, idx), shift);
+      return;
+    }
 
   size_t maxidx = shdr->sh_size / sizeof (Elf32_Word) - (4 + bitmask_words
 							 + nbuckets);
-- 
2.1.0


             reply	other threads:[~2015-05-06 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 11:10 Mark Wielaard [this message]
2015-05-12 14:46 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=1430910645-16816-1-git-send-email-mjw@redhat.com \
    --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).