Skip to content

Commit

Permalink
[NFC][hwasan] Use stored chunk in TailOverwrittenReport (#66682)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka committed Sep 21, 2023
1 parent 5cd0e5d commit ddedad8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler-rt/lib/hwasan/hwasan_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ class BaseReport {
struct HeapChunk {
uptr begin = 0;
uptr size = 0;
u32 stack_id = 0;
bool from_small_heap = false;
bool is_allocated = false;
};
Expand Down Expand Up @@ -458,6 +459,7 @@ BaseReport::HeapChunk BaseReport::CopyHeapChunk() const {
result.size = chunk.ActualSize();
result.from_small_heap = chunk.FromSmallHeap();
result.is_allocated = chunk.IsAllocated();
result.stack_id = chunk.GetAllocStackId();
}
return result;
}
Expand Down Expand Up @@ -793,12 +795,11 @@ TailOverwrittenReport::~TailOverwrittenReport() {
Printf("deallocated here:\n");
Printf("%s", d.Default());
stack->Print();
HwasanChunkView chunk = FindHeapChunkByAddress(untagged_addr);
if (chunk.Beg()) {
if (heap.begin) {
Printf("%s", d.Allocation());
Printf("allocated here:\n");
Printf("%s", d.Default());
GetStackTraceFromId(chunk.GetAllocStackId()).Print();
GetStackTraceFromId(heap.stack_id).Print();
}

InternalScopedString s;
Expand Down

0 comments on commit ddedad8

Please sign in to comment.