From 0101665f864383147448c5871a67286a3f7a9a28 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 29 Jul 2018 17:16:03 -0600 Subject: 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 * findvar.c (extract_integer): Do work in an unsigned type. --- gdb/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/ChangeLog') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 36c4493..5787d44 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2018-10-03 Tom Tromey + * findvar.c (extract_integer): Do work in an unsigned type. + +2018-10-03 Tom Tromey + * common/enum-flags.h (enum_flags::operator~): Add static assert. * symfile-add-flags.h (enum symfile_add_flag): Use unsigned as base type. -- cgit v1.1