diff options
author | Nick Clifton <nickc@redhat.com> | 2023-04-11 16:22:28 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-04-11 16:22:28 +0100 |
commit | 91496180eba5150fb169c5edaff16877eefae7f9 (patch) | |
tree | 613580ae857111e9f92ba325f27b0156eb09748a /gprof | |
parent | 9f1c612b7c1bb2d3035ca9416e5f09d844620e89 (diff) | |
download | gdb-91496180eba5150fb169c5edaff16877eefae7f9.zip gdb-91496180eba5150fb169c5edaff16877eefae7f9.tar.gz gdb-91496180eba5150fb169c5edaff16877eefae7f9.tar.bz2 |
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.
Diffstat (limited to 'gprof')
-rw-r--r-- | gprof/ChangeLog | 6 | ||||
-rw-r--r-- | gprof/symtab.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog index d49b189..33a95f2 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -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. diff --git a/gprof/symtab.c b/gprof/symtab.c index ea47aac..61feebc 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; |