aboutsummaryrefslogtreecommitdiff
path: root/bfd/xtensa-isa.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2017-08-02 10:38:09 +0100
committerNick Clifton <nickc@redhat.com>2017-08-02 10:38:09 +0100
commitd84ed528d4817b0ff854006b65a9f6ec75f0407a (patch)
tree96d049d8b0b4e453a5fbf82c190751d3e3d8769e /bfd/xtensa-isa.c
parent75800d2cd6a6cea6071dcf8f0c2ea871abeeaf99 (diff)
downloadgdb-d84ed528d4817b0ff854006b65a9f6ec75f0407a.zip
gdb-d84ed528d4817b0ff854006b65a9f6ec75f0407a.tar.gz
gdb-d84ed528d4817b0ff854006b65a9f6ec75f0407a.tar.bz2
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.
Diffstat (limited to 'bfd/xtensa-isa.c')
-rw-r--r--bfd/xtensa-isa.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
index 8da75be..8c6ee88 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. */