aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-26 18:22:37 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-26 18:22:37 -0500
commit236bf91febaa3a7b0c2231a8740968e90aa497c6 (patch)
tree6bfdfa73aef909e3aec23e739ab889f51c006d7b
parentdea10706e9159ba6e94eab4c25010f3006d033a0 (diff)
downloadgdb-236bf91febaa3a7b0c2231a8740968e90aa497c6.zip
gdb-236bf91febaa3a7b0c2231a8740968e90aa497c6.tar.gz
gdb-236bf91febaa3a7b0c2231a8740968e90aa497c6.tar.bz2
sim: bfin: avoid stack error under asan
We set up an array of 3 elements and then index into it with a 2bit value. We check the range before we actually use the pointer, but the indexing is enough to make asan upset, so just stuff a fourth value in there to keep things simple.
-rw-r--r--sim/bfin/ChangeLog4
-rw-r--r--sim/bfin/bfin-sim.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 6717fcc..fb00c8b 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,9 @@
2015-12-26 Mike Frysinger <vapier@gentoo.org>
+ * bfin-sim.c (decode_LDST_0): Add 4th element to posts array.
+
+2015-12-26 Mike Frysinger <vapier@gentoo.org>
+
* interp.c (sim_create_inferior): Update comment and argv check.
2015-12-25 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c
index b6acb4e..9737bc1 100644
--- a/sim/bfin/bfin-sim.c
+++ b/sim/bfin/bfin-sim.c
@@ -3292,7 +3292,7 @@ decode_LDST_0 (SIM_CPU *cpu, bu16 iw0)
int aop = ((iw0 >> LDST_aop_bits) & LDST_aop_mask);
int reg = ((iw0 >> LDST_reg_bits) & LDST_reg_mask);
int ptr = ((iw0 >> LDST_ptr_bits) & LDST_ptr_mask);
- const char * const posts[] = { "++", "--", "" };
+ const char * const posts[] = { "++", "--", "", "<INV>" };
const char *post = posts[aop];
const char *ptr_name = get_preg_name (ptr);