From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2124) id 0BDFD3858D32; Tue, 11 Apr 2023 15:23:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BDFD3858D32 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Clifton To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Fix an illegal memorty access when running gprof over corrupt data. X-Act-Checkin: binutils-gdb X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: 9f1c612b7c1bb2d3035ca9416e5f09d844620e89 X-Git-Newrev: 91496180eba5150fb169c5edaff16877eefae7f9 Message-Id: <20230411152302.0BDFD3858D32@sourceware.org> Date: Tue, 11 Apr 2023 15:23:02 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2023 15:23:02 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D91496180eba5= 150fb169c5edaff16877eefae7f9 commit 91496180eba5150fb169c5edaff16877eefae7f9 Author: Nick Clifton Date: Tue Apr 11 16:22:28 2023 +0100 Fix an illegal memorty access when running gprof over corrupt data. =20 PR 30324 * symtab.c (symtab_finalize): Only change the end address if dst has = been updated. Diff: --- gprof/ChangeLog | 6 ++++++ gprof/symtab.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gprof/ChangeLog b/gprof/ChangeLog index d49b1894905..33a95f272fa 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,9 @@ +2023-04-11 Nick Clifton + + PR 30324 + * symtab.c (symtab_finalize): Only change the end address if dst + has been updated. + 2023-02-20 Nick Clifton =20 * po/ms.po: Updated Malayasian translation. diff --git a/gprof/symtab.c b/gprof/symtab.c index ea47aac47b5..61feebc5d02 100644 --- a/gprof/symtab.c +++ b/gprof/symtab.c @@ -147,7 +147,7 @@ symtab_finalize (Sym_Table *tab) } } =20 - if (tab->len > 0 && dst[-1].end_addr =3D=3D 0) + if (tab->len > 0 && dst > tab->base && dst[-1].end_addr =3D=3D 0) dst[-1].end_addr =3D core_text_sect->vma + bfd_section_size (core_text_sect) - 1;