diff options
| author | Vedant Kumar <vsk@apple.com> | 2020-02-03 11:14:28 -0800 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2020-02-03 15:57:32 -0800 |
| commit | 7b90cdedd1d3f743eeb2b7654d65386672d0f1a9 (patch) | |
| tree | 47d4a9ac659d1ad201e3c641e9c79b1ef9ea0462 /clang/lib/Frontend/ASTMerge.cpp | |
| parent | ac430336318a1abe6e4726e8df49ee0e6b779691 (diff) | |
| download | llvm-7b90cdedd1d3f743eeb2b7654d65386672d0f1a9.zip llvm-7b90cdedd1d3f743eeb2b7654d65386672d0f1a9.tar.gz llvm-7b90cdedd1d3f743eeb2b7654d65386672d0f1a9.tar.bz2 | |
[lldb/DataExtractor] Fix UB shift in GetMaxS64Bitfield
DataExtractor::GetMaxS64Bitfield performs a shift with UB in order to
construct a bitmask when bitfield_bit_size is 64. The current
implementation actually does “work” in this case, because the assumption
that the shift result is 0 holds, and 0 minus 1 gives the all-ones value
(the correct mask). However, the more readable/maintainable approach
might be to use an off-the-shelf UB-free helper.
Fixes a UBSan issue:
"col" : 37,
"description" : "invalid-shift-exponent",
"filename" : "/Users/vsk/src/llvm-project-master/lldb/source/Utility/DataExtractor.cpp",
"instrumentation_class" : "UndefinedBehaviorSanitizer",
"line" : 615,
"memory_address" : 0,
"summary" : "Shift exponent 64 is too large for 64-bit type 'uint64_t' (aka 'unsigned long long')",
rdar://59117758
Differential Revision: https://reviews.llvm.org/D73913
Diffstat (limited to 'clang/lib/Frontend/ASTMerge.cpp')
0 files changed, 0 insertions, 0 deletions
