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/ChangeLog | |
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/ChangeLog')
-rw-r--r-- | opcodes/ChangeLog | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d3f1e69..faa160a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,5 +1,15 @@ 2019-12-11 Alan Modra <amodra@gmail.com> + * 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. + +2019-12-11 Alan Modra <amodra@gmail.com> + * arc-dis.c (find_format_from_table): Use ull constant when shifting by up to 32. |