ubsan: cris: signed integer overflow
authorAlan Modra <amodra@gmail.com>
Tue, 10 Dec 2019 12:52:10 +0000 (23:22 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Dec 2019 01:08:24 +0000 (11:38 +1030)
commitc202f69e5130fed314afa079ce30abaad4d34991
treec4e19f714b47d869d10de621416ebd7436d24ba6
parent0ef562a4b5da6bc1f16b2ea801b228acafd033d8
ubsan: cris: signed integer overflow

This was the following in print_with_operands
case 4:
  number
    = buffer[2] + buffer[3] * 256 + buffer[4] * 65536
    + buffer[5] * 0x1000000;
and buffer[5] * 0x1000000 can indeed overflow.  So to fix this we need
to use unsigned arithmetic where overflow semantics are specified.
But number is a long, and the expression is int which will be sign
extended to long.  If we make the expression unsigned it will be zero
extended.  So make number an int32_t and rearrange a little for some
of the places that need fixing.

* cris-dis.c (print_with_operands): Avoid signed integer
overflow when collecting bytes of a 32-bit integer.
opcodes/ChangeLog
opcodes/cris-dis.c
This page took 0.025061 seconds and 4 git commands to generate.