From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68443 invoked by alias); 24 Mar 2017 11:06:50 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 64810 invoked by uid 48); 24 Mar 2017 11:06:46 -0000 From: "mjw at redhat dot com" To: elfutils-devel@sourceware.org Subject: [Bug tools/21299] heap-based buffer overflow in handle_gnu_hash (readelf.c) Date: Fri, 24 Mar 2017 11:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: tools X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjw at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2017-q1/txt/msg00108.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D21299 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mjw at redhat dot com --- Comment #1 from Mark Wielaard --- Thanks, it was an off-by-one sanity check. diff --git a/src/readelf.c b/src/readelf.c index 8d96ba3..490b6d5 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -3263,7 +3263,7 @@ handle_gnu_hash (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *s= hdr,=20 ++nsyms; if (maxlength < ++lengths[cnt]) ++maxlength; - if (inner > max_nsyms) + if (inner >=3D max_nsyms) goto invalid_data; } while ((chain[inner++] & 1) =3D=3D 0); max_nsyms is the maximum number, but inner is a zero-based index. --=20 You are receiving this mail because: You are on the CC list for the bug.