From d84ed528d4817b0ff854006b65a9f6ec75f0407a Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Wed, 2 Aug 2017 10:38:09 +0100 Subject: [PATCH] Fix potential illegal memory access in Xtensa port. * xtensa-isa.c (xtensa_isa_init): Don't update lookup table entries for sysregs with negative indices. --- bfd/ChangeLog | 5 +++++ bfd/xtensa-isa.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d7d53d6022f..fd93c306b61 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2017-08-02 Max Filippov + + * xtensa-isa.c (xtensa_isa_init): Don't update lookup table + entries for sysregs with negative indices. + 2017-08-01 Andreas Krebbel * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c index 8da75bea810..8c6ee88fdea 100644 --- a/bfd/xtensa-isa.c +++ b/bfd/xtensa-isa.c @@ -292,7 +292,8 @@ xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p) xtensa_sysreg_internal *sreg = &isa->sysregs[n]; is_user = sreg->is_user; - isa->sysreg_table[is_user][sreg->number] = n; + if (sreg->number >= 0) + isa->sysreg_table[is_user][sreg->number] = n; } /* Set up the interface lookup table. */ -- 2.30.2