diff options
author | Alan Modra <amodra@gmail.com> | 2019-12-24 10:11:40 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-12-24 12:01:42 +1030 |
commit | ebd1c6d1d30fb41827ea37895b9cdff939e5952a (patch) | |
tree | d535b546a0e0ce9d62aa00d1e0b349d58375de89 /opcodes | |
parent | c71a963d8e2d48e9b0faf3ef8a821d25c26077d2 (diff) | |
download | gdb-ebd1c6d1d30fb41827ea37895b9cdff939e5952a.zip gdb-ebd1c6d1d30fb41827ea37895b9cdff939e5952a.tar.gz gdb-ebd1c6d1d30fb41827ea37895b9cdff939e5952a.tar.bz2 |
ubsan: arm: shift exponent 32 is too large for 32-bit type 'unsigned int'
* arm-dis.c (print_insn_arm): Don't shift by 32 on unsigned int var.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 4 | ||||
-rw-r--r-- | opcodes/arm-dis.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 979ca97..bdbb5f7 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2019-12-24 Alan Modra <amodra@gmail.com> + + * arm-dis.c (print_insn_arm): Don't shift by 32 on unsigned int var. + 2019-12-23 Jan Beulich <jbeulich@suse.com> * ppc-dis.c (print_insn_powerpc): Rename local variable "spaces" diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 12eae61..d7e21f9 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -9927,12 +9927,12 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given) unsigned int immed = (given & 0xff); unsigned int a, i; - a = (((immed << (32 - rotate)) - | (immed >> rotate)) & 0xffffffff); + a = (immed << ((32 - rotate) & 31) + | immed >> rotate) & 0xffffffff; /* If there is another encoding with smaller rotate, the rotate should be specified directly. */ for (i = 0; i < 32; i += 2) - if ((a << i | a >> (32 - i)) <= 0xff) + if ((a << i | a >> ((32 - i) & 31)) <= 0xff) break; if (i != rotate) |