From: Nick Clifton Date: Tue, 11 Apr 2023 15:22:28 +0000 (+0100) Subject: Fix an illegal memorty access when running gprof over corrupt data. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91496180eba5150fb169c5edaff16877eefae7f9;p=binutils-gdb.git Fix an illegal memorty access when running gprof over corrupt data. PR 30324 * symtab.c (symtab_finalize): Only change the end address if dst has been updated. --- 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 * 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) } } - if (tab->len > 0 && dst[-1].end_addr == 0) + if (tab->len > 0 && dst > tab->base && dst[-1].end_addr == 0) dst[-1].end_addr = core_text_sect->vma + bfd_section_size (core_text_sect) - 1;