ubsan: csky: left shift cannot be represented in type 'int'
authorAlan Modra <amodra@gmail.com>
Tue, 10 Dec 2019 13:07:03 +0000 (23:37 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Dec 2019 01:08:45 +0000 (11:38 +1030)
commitd93bba9e0d6c7bd3a570688612a3dd0a5eb0193a
treeec55590cd16f5df7b8ca806f773181ace2294e50
parentc202f69e5130fed314afa079ce30abaad4d34991
ubsan: csky: left shift cannot be represented in type 'int'

In the following buf is an unsigned char array, so elements are
promoted to int before arithmetic operations.

  if (dis_info.info->endian == BFD_ENDIAN_BIG)
    while (n--)
      val |= buf[n] << (n*8);
  else
    for (i = 0; i < n; i++)
      val |= buf[i] << (i*8);

* csky-dis.c (csky_chars_to_number): Rewrite.  Avoid signed
overflow when collecting bytes of a number.
opcodes/ChangeLog
opcodes/csky-dis.c