From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102660 invoked by alias); 30 May 2018 12:50:09 -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 101847 invoked by uid 48); 30 May 2018 12:50:05 -0000 From: "mark at klomp dot org" To: elfutils-devel@sourceware.org Subject: [Bug tools/23248] armv7l: dwarf_getsrclines.c:362:37: error: argument 1 value '4294967288' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=] Date: Wed, 30 May 2018 12:50: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: mark at klomp dot org 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: 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: 2018-q2/txt/msg00117.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D23248 --- Comment #3 from Mark Wielaard --- Martin pointed out that only works (on 64bit) if ndirlist was actually a si= ze_t (like nfilelist already is). So the full patch would be: diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c index 2bf30984..790d4e49 100644 --- a/libdw/dwarf_getsrclines.c +++ b/libdw/dwarf_getsrclines.c @@ -154,7 +154,7 @@ read_srclines (Dwarf *dbg, int res =3D -1; size_t nfilelist =3D 0; - unsigned int ndirlist =3D 0; + size_t ndirlist =3D 0; /* If there are a large number of lines, files or dirs don't blow up the stack. Stack allocate some entries, only dynamically malloc @@ -299,7 +299,7 @@ read_srclines (Dwarf *dbg, }; /* First count the entries. */ - unsigned int ndirs =3D 0; + size_t ndirs =3D 0; if (version < 5) { const unsigned char *dirp =3D linep; @@ -359,6 +359,8 @@ read_srclines (Dwarf *dbg, ndirlist =3D ndirs; if (ndirlist >=3D MAX_STACK_DIRS) { + if (ndirlist > SIZE_MAX / sizeof (*dirarray)) + goto no_mem; dirarray =3D (struct dirlist *) malloc (ndirlist * sizeof (*dirarray= )); if (unlikely (dirarray =3D=3D NULL)) { --=20 You are receiving this mail because: You are on the CC list for the bug.