[compiler-rt] problem #77737 Fix a possible null dereference (PR #78985)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 22 06:54:33 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0175a1e4d33720ed7e827b3db5a36f88bdd790a3 3bebf2ae6ce886edd5a4f9e989ecef6cbfaddb64 -- compiler-rt/lib/hwasan/hwasan_report.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 6765888ce7..2ee7ac520c 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -12,7 +12,9 @@
//===----------------------------------------------------------------------===//
#include "hwasan_report.h"
+
#include <dlfcn.h>
+
#include "hwasan.h"
#include "hwasan_allocator.h"
#include "hwasan_globals.h"
@@ -148,9 +150,9 @@ class SavedStackAllocations {
u32 thread_id_;
};
-class Decorator: public __sanitizer::SanitizerCommonDecorator {
+class Decorator : public __sanitizer::SanitizerCommonDecorator {
public:
- Decorator() : SanitizerCommonDecorator() { }
+ Decorator() : SanitizerCommonDecorator() {}
const char *Access() { return Blue(); }
const char *Allocation() const { return Magenta(); }
const char *Origin() const { return Magenta(); }
@@ -164,7 +166,8 @@ static bool FindHeapAllocation(HeapAllocationsRingBuffer *rb, uptr tagged_addr,
HeapAllocationRecord *har, uptr *ring_index,
uptr *num_matching_addrs,
uptr *num_matching_addrs_4b) {
- if (!rb) return false;
+ if (!rb)
+ return false;
*num_matching_addrs = 0;
*num_matching_addrs_4b = 0;
@@ -188,9 +191,7 @@ static bool FindHeapAllocation(HeapAllocationsRingBuffer *rb, uptr tagged_addr,
// Measure the number of heap ring buffer entries that would have matched
// if we only had 4 tag bits, which is the case for MTE.
- auto untag_4b = [](uptr p) {
- return p & ((1ULL << 60) - 1);
- };
+ auto untag_4b = [](uptr p) { return p & ((1ULL << 60) - 1); };
if (untag_4b(h.tagged_addr) <= untag_4b(tagged_addr) &&
untag_4b(h.tagged_addr) + h.requested_size > untag_4b(tagged_addr)) {
++*num_matching_addrs_4b;
@@ -1058,25 +1059,25 @@ void ReportRegisters(const uptr *frame, uptr pc) {
// result in a new logcat line, irrespective of whether a newline is present,
// and so we wish to reduce the number of Printf() calls we have to make.
#if defined(__aarch64__)
- Printf(" x0 %016llx x1 %016llx x2 %016llx x3 %016llx\n",
- frame[0], frame[1], frame[2], frame[3]);
+ Printf(" x0 %016llx x1 %016llx x2 %016llx x3 %016llx\n", frame[0],
+ frame[1], frame[2], frame[3]);
#elif SANITIZER_RISCV64
Printf(" sp %016llx x1 %016llx x2 %016llx x3 %016llx\n",
reinterpret_cast<const u8 *>(frame) + 256, frame[1], frame[2],
frame[3]);
#endif
- Printf(" x4 %016llx x5 %016llx x6 %016llx x7 %016llx\n",
- frame[4], frame[5], frame[6], frame[7]);
- Printf(" x8 %016llx x9 %016llx x10 %016llx x11 %016llx\n",
- frame[8], frame[9], frame[10], frame[11]);
- Printf(" x12 %016llx x13 %016llx x14 %016llx x15 %016llx\n",
- frame[12], frame[13], frame[14], frame[15]);
- Printf(" x16 %016llx x17 %016llx x18 %016llx x19 %016llx\n",
- frame[16], frame[17], frame[18], frame[19]);
- Printf(" x20 %016llx x21 %016llx x22 %016llx x23 %016llx\n",
- frame[20], frame[21], frame[22], frame[23]);
- Printf(" x24 %016llx x25 %016llx x26 %016llx x27 %016llx\n",
- frame[24], frame[25], frame[26], frame[27]);
+ Printf(" x4 %016llx x5 %016llx x6 %016llx x7 %016llx\n", frame[4],
+ frame[5], frame[6], frame[7]);
+ Printf(" x8 %016llx x9 %016llx x10 %016llx x11 %016llx\n", frame[8],
+ frame[9], frame[10], frame[11]);
+ Printf(" x12 %016llx x13 %016llx x14 %016llx x15 %016llx\n", frame[12],
+ frame[13], frame[14], frame[15]);
+ Printf(" x16 %016llx x17 %016llx x18 %016llx x19 %016llx\n", frame[16],
+ frame[17], frame[18], frame[19]);
+ Printf(" x20 %016llx x21 %016llx x22 %016llx x23 %016llx\n", frame[20],
+ frame[21], frame[22], frame[23]);
+ Printf(" x24 %016llx x25 %016llx x26 %016llx x27 %016llx\n", frame[24],
+ frame[25], frame[26], frame[27]);
// hwasan_check* reduces the stack pointer by 256, then __hwasan_tag_mismatch
// passes it to this function.
#if defined(__aarch64__)
``````````
</details>
https://github.com/llvm/llvm-project/pull/78985
More information about the llvm-commits
mailing list