]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: bfin: avoid stack error under asan
authorMike Frysinger <vapier@gentoo.org>
Sat, 26 Dec 2015 23:22:37 +0000 (18:22 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 26 Dec 2015 23:22:37 +0000 (18:22 -0500)
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.

sim/bfin/ChangeLog
sim/bfin/bfin-sim.c

index 6717fcc9e09745f1fafc2a238c0dccc9c87147a3..fb00c8b52f9277bc61a7d7f5dd86deb925bb3fc2 100644 (file)
@@ -1,3 +1,7 @@
+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.
index b6acb4e6a50b42ae84d983ae4961fe7637d43ff8..9737bc1797f866f2251d54f2b4ea6ab9eb1e83e4 100644 (file)
@@ -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);