Skip to content

Commit ddedad8

Browse files
committed
[NFC][hwasan] Use stored chunk in TailOverwrittenReport (#66682)
1 parent 5cd0e5d commit ddedad8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler-rt/lib/hwasan/hwasan_report.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ class BaseReport {
423423
struct HeapChunk {
424424
uptr begin = 0;
425425
uptr size = 0;
426+
u32 stack_id = 0;
426427
bool from_small_heap = false;
427428
bool is_allocated = false;
428429
};
@@ -458,6 +459,7 @@ BaseReport::HeapChunk BaseReport::CopyHeapChunk() const {
458459
result.size = chunk.ActualSize();
459460
result.from_small_heap = chunk.FromSmallHeap();
460461
result.is_allocated = chunk.IsAllocated();
462+
result.stack_id = chunk.GetAllocStackId();
461463
}
462464
return result;
463465
}
@@ -793,12 +795,11 @@ TailOverwrittenReport::~TailOverwrittenReport() {
793795
Printf("deallocated here:\n");
794796
Printf("%s", d.Default());
795797
stack->Print();
796-
HwasanChunkView chunk = FindHeapChunkByAddress(untagged_addr);
797-
if (chunk.Beg()) {
798+
if (heap.begin) {
798799
Printf("%s", d.Allocation());
799800
Printf("allocated here:\n");
800801
Printf("%s", d.Default());
801-
GetStackTraceFromId(chunk.GetAllocStackId()).Print();
802+
GetStackTraceFromId(heap.stack_id).Print();
802803
}
803804

804805
InternalScopedString s;

0 commit comments

Comments
 (0)