aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-16 09:59:23 +1030
committerAlan Modra <amodra@gmail.com>2019-12-16 17:35:13 +1030
commit488d02fe7729dda5b9414a3942df68e0c316ce53 (patch)
tree25e2e7cf2cb6f3c901570078d904d3995b88843d /opcodes
parent8a92faab92e359a860da6c69741acd1fac24dad6 (diff)
downloadgdb-488d02fe7729dda5b9414a3942df68e0c316ce53.zip
gdb-488d02fe7729dda5b9414a3942df68e0c316ce53.tar.gz
gdb-488d02fe7729dda5b9414a3942df68e0c316ce53.tar.bz2
ubsan: microblaze: left shift cannot be represented in type 'int'
* microblaze-dis.c (read_insn_microblaze): Avoid signed overflow.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/microblaze-dis.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 113fd09..d33c7a1 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
2019-12-16 Alan Modra <amodra@gmail.com>
+ * microblaze-dis.c (read_insn_microblaze): Avoid signed overflow.
+
+2019-12-16 Alan Modra <amodra@gmail.com>
+
* nios2-dis.c (nios2_print_insn_arg): Avoid signed overflow
2019-12-16 Alan Modra <amodra@gmail.com>
diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
index 2b3aa8e..5df7ae4 100644
--- a/opcodes/microblaze-dis.c
+++ b/opcodes/microblaze-dis.c
@@ -200,9 +200,11 @@ read_insn_microblaze (bfd_vma memaddr,
}
if (info->endian == BFD_ENDIAN_BIG)
- inst = (ibytes[0] << 24) | (ibytes[1] << 16) | (ibytes[2] << 8) | ibytes[3];
+ inst = (((unsigned) ibytes[0] << 24) | (ibytes[1] << 16)
+ | (ibytes[2] << 8) | ibytes[3]);
else if (info->endian == BFD_ENDIAN_LITTLE)
- inst = (ibytes[3] << 24) | (ibytes[2] << 16) | (ibytes[1] << 8) | ibytes[0];
+ inst = (((unsigned) ibytes[3] << 24) | (ibytes[2] << 16)
+ | (ibytes[1] << 8) | ibytes[0]);
else
abort ();