diff options
author | Alan Modra <amodra@gmail.com> | 2019-12-10 22:32:06 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-12-11 11:37:44 +1030 |
commit | 2fd2b153a3819d3ab6b9c4cf06943d498187714c (patch) | |
tree | 62c7e56be47841b7fff485fe599df8ea5fcd412f /opcodes/cr16-dis.c | |
parent | a11db3e9f3a679601f41671a9e7f54c37f2c5073 (diff) | |
download | gdb-2fd2b153a3819d3ab6b9c4cf06943d498187714c.zip gdb-2fd2b153a3819d3ab6b9c4cf06943d498187714c.tar.gz gdb-2fd2b153a3819d3ab6b9c4cf06943d498187714c.tar.bz2 |
ubsan: bfin: shift exponent is too large
This was the following in fmtconst_val, x is unsigned int.
x = SIGNEXTEND (x, constant_formats[cf].nbits);
Problem is, the SIGNEXTEND macro assumed its arg was a long and sign
extended by shifting left then shifting right, and didn't cast the
arg. So don't do the silly shift thing. It's not guaranteed to work
anyway according to the C standard. ">>" might do a logical shift
even if its args are signed.
* bfin-dis.c (HOST_LONG_WORD_SIZE, XFIELD): Delete.
(SIGNBIT): New.
(MASKBITS, SIGNEXTEND): Rewrite.
(fmtconst): Don't use ? expression now that SIGNEXTEND uses
unsigned arithmetic, instead assign result of SIGNEXTEND back
to x.
(fmtconst_val): Use 1u in shift expression.
Diffstat (limited to 'opcodes/cr16-dis.c')
0 files changed, 0 insertions, 0 deletions