@@ -458,6 +458,17 @@ class BaseReport {
458
458
access_size(access_size),
459
459
untagged_addr(UntagAddr(tagged_addr)),
460
460
ptr_tag(GetTagFromPointer(tagged_addr)) {
461
+ if (MemIsShadow (untagged_addr))
462
+ return ;
463
+
464
+ HwasanChunkView chunk = FindHeapChunkByAddress (untagged_addr);
465
+ heap.begin = chunk.Beg ();
466
+ if (heap.begin ) {
467
+ heap.size = chunk.ActualSize ();
468
+ heap.from_small_heap = chunk.FromSmallHeap ();
469
+ heap.is_allocated = chunk.IsAllocated ();
470
+ }
471
+
461
472
hwasanThreadList ().VisitAllLiveThreads ([&](Thread *t) {
462
473
if (stack_allocations_count < ARRAY_SIZE (stack_allocations) &&
463
474
t->AddrIsInStack (untagged_addr)) {
@@ -475,8 +486,16 @@ class BaseReport {
475
486
uptr access_size = 0 ;
476
487
uptr untagged_addr = 0 ;
477
488
tag_t ptr_tag = 0 ;
489
+
478
490
uptr stack_allocations_count = 0 ;
479
491
SavedStackAllocations stack_allocations[16 ];
492
+
493
+ struct {
494
+ uptr begin = 0 ;
495
+ uptr size = 0 ;
496
+ bool from_small_heap = false ;
497
+ bool is_allocated = false ;
498
+ } heap;
480
499
};
481
500
482
501
void BaseReport::PrintAddressDescription () const {
@@ -490,17 +509,14 @@ void BaseReport::PrintAddressDescription() const {
490
509
}
491
510
492
511
// Print some very basic information about the address, if it's a heap.
493
- HwasanChunkView chunk = FindHeapChunkByAddress (untagged_addr);
494
- if (uptr beg = chunk.Beg ()) {
495
- uptr size = chunk.ActualSize ();
496
- Printf (" %s[%p,%p) is a %s %s heap chunk; "
497
- " size: %zd offset: %zd\n %s" ,
498
- d.Location (),
499
- beg, beg + size,
500
- chunk.FromSmallHeap () ? " small" : " large" ,
501
- chunk.IsAllocated () ? " allocated" : " unallocated" ,
502
- size, untagged_addr - beg,
503
- d.Default ());
512
+ if (heap.begin ) {
513
+ Printf (
514
+ " %s[%p,%p) is a %s %s heap chunk; "
515
+ " size: %zd offset: %zd\n %s" ,
516
+ d.Location (), heap.begin , heap.begin + heap.size ,
517
+ heap.from_small_heap ? " small" : " large" ,
518
+ heap.is_allocated ? " allocated" : " unallocated" , heap.size ,
519
+ untagged_addr - heap.begin , d.Default ());
504
520
}
505
521
506
522
// Check stack first. If the address is on the stack of a live thread, we
0 commit comments