diff options
author | Alan Modra <amodra@gmail.com> | 2020-01-10 08:27:33 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-01-10 17:32:33 +1030 |
commit | 7f578b959c3d4b4a1756c66aec4426743b82c6b8 (patch) | |
tree | 96b17e2e3cc3d4f33f80bd6b42c4d6da50b94986 /opcodes/tilepro-opc.c | |
parent | 441af85bd9c68dbc0c2a1dbe23bf07c6cb3c3f5d (diff) | |
download | gdb-7f578b959c3d4b4a1756c66aec4426743b82c6b8.zip gdb-7f578b959c3d4b4a1756c66aec4426743b82c6b8.tar.gz gdb-7f578b959c3d4b4a1756c66aec4426743b82c6b8.tar.bz2 |
ubsan: tilepro: signed integer overflow
* tilepro-opc.c (parse_insn_tilepro): Make opval unsigned.
* tilegx-opc.c (parse_insn_tilegx): Likewise. Delete raw_opval.
Diffstat (limited to 'opcodes/tilepro-opc.c')
-rw-r--r-- | opcodes/tilepro-opc.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/opcodes/tilepro-opc.c b/opcodes/tilepro-opc.c index 6449945..dbe0605 100644 --- a/opcodes/tilepro-opc.c +++ b/opcodes/tilepro-opc.c @@ -10215,7 +10215,7 @@ parse_insn_tilepro (tilepro_bundle_bits bits, { const struct tilepro_operand *op = &tilepro_operands[opc->operands[pipe][i]]; - int opval = op->extract (bits); + unsigned int opval = op->extract (bits); if (op->is_signed) { @@ -10226,10 +10226,7 @@ parse_insn_tilepro (tilepro_bundle_bits bits, /* Adjust PC-relative scaled branch offsets. */ if (op->type == TILEPRO_OP_TYPE_ADDRESS) - { - opval *= TILEPRO_BUNDLE_SIZE_IN_BYTES; - opval += (int)pc; - } + opval = opval * TILEPRO_BUNDLE_SIZE_IN_BYTES + pc; /* Record the final value. */ d->operands[i] = op; |