From b84f6152ee8bb141acae181b34a51c3e58da8930 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 11 Dec 2019 08:52:22 +1030 Subject: ubsan: tic6x: shift left of int * tic6x-dis.c (tic6x_extract_32): Avoid signed overflow. --- opcodes/ChangeLog | 4 ++++ opcodes/tic6x-dis.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 3ae93c1..3ba885c 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,9 @@ 2019-12-11 Alan Modra + * tic6x-dis.c (tic6x_extract_32): Avoid signed overflow. + +2019-12-11 Alan Modra + * tic4x-dis.c (tic4x_print_register): Formatting. Don't segfault on NULL registertable entry. (tic4x_hash_opcode): Use unsigned arithmetic. 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. */ -- cgit v1.1