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.
This commit is contained in:
Nick Clifton 2023-04-11 16:22:28 +01:00
parent 9f1c612b7c
commit 91496180eb
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2023-04-11 Nick Clifton <nickc@redhat.com>
PR 30324
* symtab.c (symtab_finalize): Only change the end address if dst
has been updated.
2023-02-20 Nick Clifton <nickc@redhat.com>
* po/ms.po: Updated Malayasian translation.

View File

@ -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;