diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-29 20:23:33 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-10-03 15:19:06 -0600 |
commit | 20562150d8a894bc91657c843ee88c508188e32e (patch) | |
tree | b211b0f74e83b41e417b21e6e9faa905b49acc4e /gdb/expression.h | |
parent | d359392f976d48b04a27e6a09b5b61846b0727f9 (diff) | |
download | binutils-20562150d8a894bc91657c843ee88c508188e32e.zip binutils-20562150d8a894bc91657c843ee88c508188e32e.tar.gz binutils-20562150d8a894bc91657c843ee88c508188e32e.tar.bz2 |
Avoid undefined behavior in parse_number
-fsanitize=undefined pointed out that c-exp.y relied on undefined
behavior here:
if (c != 'l' && c != 'u')
n *= base;
...when a large hex constant "just fit" into a LONGEST, causing the
high bit to be set.
This fixes the problem by having the function work in an unsigned
type.
gdb/ChangeLog
2018-10-03 Tom Tromey <tom@tromey.com>
* c-exp.y (parse_number): Work in unsigned. Remove casts.
Diffstat (limited to 'gdb/expression.h')
0 files changed, 0 insertions, 0 deletions