ubsan: tic6x: shift left of int
authorAlan Modra <amodra@gmail.com>
Tue, 10 Dec 2019 22:22:22 +0000 (08:52 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Dec 2019 01:11:27 +0000 (11:41 +1030)
* tic6x-dis.c (tic6x_extract_32): Avoid signed overflow.

opcodes/ChangeLog
opcodes/tic6x-dis.c

index 3ae93c16414ad07949880626eb8b2447569c24fb..3ba885c48b9b5d077fefaf1aab52d89be1ff54a3 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
+       * tic6x-dis.c (tic6x_extract_32): Avoid signed overflow.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
        * tic4x-dis.c (tic4x_print_register): Formatting.  Don't segfault
index 36075da115725f45082806b3871a436cbab0ebdf..45a1e98f2a26cb6d57e32e98c5177978beb9d0be 100644 (file)
@@ -163,9 +163,9 @@ static unsigned int
 tic6x_extract_32 (unsigned char *p, struct disassemble_info *info)
 {
   if (info->endian == BFD_ENDIAN_LITTLE)
-    return (p[0]) | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
+    return p[0] | (p[1] << 8) | (p[2] << 16) | ((unsigned) p[3] << 24);
   else
-    return (p[3]) | (p[2] << 8) | (p[1] << 16) | (p[0] << 24);
+    return p[3] | (p[2] << 8) | (p[1] << 16) | ((unsigned) p[0] << 24);
 }
 
 /* Extract a 16-bit value read from the instruction stream.  */
This page took 0.040803 seconds and 4 git commands to generate.