From: Jan Kratochvil Date: Fri, 5 Jun 2020 09:59:26 +0000 (+0200) Subject: [lldb] Fix UBSan regression in GetSLEB128 X-Git-Tag: llvmorg-12-init~4027 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=846909e2ab0bd279ae2a8ec86074521f59c49eb3;p=platform%2Fupstream%2Fllvm.git [lldb] Fix UBSan regression in GetSLEB128 It regressed recently by my: https://reviews.llvm.org/D81119 --- diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp index 5f4abb8..023190b 100644 --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -930,8 +930,10 @@ int64_t DataExtractor::GetSLEB128(offset_t *offset_ptr) const { } // Sign bit of byte is 2nd high order bit (0x40) - if (shift < size && (byte & 0x40)) - result |= -(static_cast(1) << shift); + if (shift < size && (byte & 0x40)) { + // -(static_cast(1) << 63) errors on the negation with UBSan. + result |= -(static_cast(1) << shift); + } *offset_ptr += bytecount; return result;