aboutsummaryrefslogtreecommitdiff
path: root/opcodes/tic6x-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-11 08:52:22 +1030
committerAlan Modra <amodra@gmail.com>2019-12-11 11:41:27 +1030
commitb84f6152ee8bb141acae181b34a51c3e58da8930 (patch)
tree7c0387be7700f747c43723d3b648666e097d5d19 /opcodes/tic6x-dis.c
parent66152f16685fe63a5b2eb941c2d7057bbff5cfe5 (diff)
downloadfsf-binutils-gdb-b84f6152ee8bb141acae181b34a51c3e58da8930.zip
fsf-binutils-gdb-b84f6152ee8bb141acae181b34a51c3e58da8930.tar.gz
fsf-binutils-gdb-b84f6152ee8bb141acae181b34a51c3e58da8930.tar.bz2
ubsan: tic6x: shift left of int
* tic6x-dis.c (tic6x_extract_32): Avoid signed overflow.
Diffstat (limited to 'opcodes/tic6x-dis.c')
-rw-r--r--opcodes/tic6x-dis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/opcodes/tic6x-dis.c b/opcodes/tic6x-dis.c
index 36075da..45a1e98 100644
--- a/opcodes/tic6x-dis.c
+++ b/opcodes/tic6x-dis.c
@@ -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. */