aboutsummaryrefslogtreecommitdiff
path: root/opcodes/s12z-opc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-11 08:37:53 +1030
committerAlan Modra <amodra@gmail.com>2019-12-11 11:40:51 +1030
commit205c426a9bb387204a21165e2275e31c32248035 (patch)
tree98858f5426369d3f2b7315fa6b8822bfe1238e0c /opcodes/s12z-opc.c
parentfb4cb4e26d16f928f00973fcdc99934c9174c957 (diff)
downloadgdb-205c426a9bb387204a21165e2275e31c32248035.zip
gdb-205c426a9bb387204a21165e2275e31c32248035.tar.gz
gdb-205c426a9bb387204a21165e2275e31c32248035.tar.bz2
ubsan: s12z: left shift cannot be represented in type 'int'
* s12z-opc.c (z_decode_signed_value): Avoid signed overflow.
Diffstat (limited to 'opcodes/s12z-opc.c')
-rw-r--r--opcodes/s12z-opc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/opcodes/s12z-opc.c b/opcodes/s12z-opc.c
index 3e0c0e0..044c72a 100644
--- a/opcodes/s12z-opc.c
+++ b/opcodes/s12z-opc.c
@@ -410,9 +410,7 @@ z_decode_signed_value (struct mem_read_abstraction_base *mra, int offset,
int i;
uint32_t value = 0;
for (i = 0; i < size; ++i)
- {
- value |= buffer[i] << (8 * (size - i - 1));
- }
+ value = (value << 8) | buffer[i];
if (buffer[0] & 0x80)
{