Fix potential illegal memory access in Xtensa port.
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 2 Aug 2017 09:38:09 +0000 (10:38 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 2 Aug 2017 09:38:09 +0000 (10:38 +0100)
* xtensa-isa.c (xtensa_isa_init): Don't update lookup table
entries for sysregs with negative indices.

bfd/ChangeLog
bfd/xtensa-isa.c

index d7d53d6022f110da1ebb65e1db5e92dfa24c0d73..fd93c306b6128ef2131a20cc6c9fb00c780afe9d 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
+
+       * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
+       entries for sysregs with negative indices.
+
 2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
index 8da75bea8109718e9d41cfcc8596d227cf9cb594..8c6ee88fdeaea4c1ec247852f8fab7e677aeeda7 100644 (file)
@@ -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.  */