Avoid undefined behavior in extract_integer
authorTom Tromey <tom@tromey.com>
Sun, 29 Jul 2018 23:16:03 +0000 (17:16 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 3 Oct 2018 21:19:06 +0000 (15:19 -0600)
commit0101665f864383147448c5871a67286a3f7a9a28
treedd4ce1e0693c6756fd37ca693294abf8dc7fca1b
parentad69edbb4b230582ecd1863e68d0c2044f5ad901
Avoid undefined behavior in extract_integer

-fsanitize=undefined showed that extract_integer could left-shift a
negative value, which is undefined.  This patch fixes the problem by
doing all the work in an unsigned type.  This relies on
implementation-defined behavior, but I tend to think we are on safe
ground there.  (Also, if need be, violations of this could probably be
detected, either by configure or by a static_assert.)

gdb/ChangeLog
2018-10-03  Tom Tromey  <tom@tromey.com>

* findvar.c (extract_integer): Do work in an unsigned type.
gdb/ChangeLog
gdb/findvar.c
This page took 0.024885 seconds and 4 git commands to generate.