[binutils-gdb] ubsan: visium: left shift cannot be represented in type 'int'

Alan Modra amodra@sourceware.org
Tue Dec 17 12:49:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb7b504651ff7b44a7328cd967629d8f1d114a4b

commit eb7b504651ff7b44a7328cd967629d8f1d114a4b
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Dec 17 23:11:02 2019 +1030

    ubsan: visium: left shift cannot be represented in type 'int'
    
    	* visium-dis.c (print_insn_visium): Avoid signed overflow.

Diff:
---
 opcodes/ChangeLog    | 4 ++++
 opcodes/visium-dis.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e2aa20b..aac14ea 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
 2019-12-17  Alan Modra  <amodra@gmail.com>
 
+	* visium-dis.c (print_insn_visium): Avoid signed overflow.
+
+2019-12-17  Alan Modra  <amodra@gmail.com>
+
 	* aarch64-opc.c (value_fit_signed_field_p): Avoid signed overflow.
 	(value_fit_unsigned_field_p): Likewise.
 	(aarch64_wide_constant_p): Likewise.
diff --git a/opcodes/visium-dis.c b/opcodes/visium-dis.c
index 41943ad..1f081f1 100644
--- a/opcodes/visium-dis.c
+++ b/opcodes/visium-dis.c
@@ -789,7 +789,7 @@ print_insn_visium (bfd_vma addr, disassemble_info *info)
 
   /* Get 32-bit instruction word.  */
   FETCH_DATA (info, buffer + 4);
-  ins = buffer[0] << 24;
+  ins = (unsigned) buffer[0] << 24;
   ins |= buffer[1] << 16;
   ins |= buffer[2] << 8;
   ins |= buffer[3];



More information about the Binutils-cvs mailing list