@@ -390,21 +390,8 @@ class BaseReport {
390
390
if (MemIsShadow (untagged_addr))
391
391
return ;
392
392
393
- HwasanChunkView chunk = FindHeapChunkByAddress (untagged_addr);
394
- heap.begin = chunk.Beg ();
395
- if (heap.begin ) {
396
- heap.size = chunk.ActualSize ();
397
- heap.from_small_heap = chunk.FromSmallHeap ();
398
- heap.is_allocated = chunk.IsAllocated ();
399
- }
400
-
401
- hwasanThreadList ().VisitAllLiveThreads ([&](Thread *t) {
402
- if (stack_allocations_count < ARRAY_SIZE (stack_allocations) &&
403
- t->AddrIsInStack (untagged_addr)) {
404
- stack_allocations[stack_allocations_count++].CopyFrom (t);
405
- }
406
- });
407
-
393
+ CopyHeapChunk ();
394
+ CopyStackAllocations ();
408
395
candidate = FindBufferOverflowCandidate ();
409
396
}
410
397
@@ -423,6 +410,8 @@ class BaseReport {
423
410
} heap;
424
411
};
425
412
413
+ void CopyHeapChunk ();
414
+ void CopyStackAllocations ();
426
415
OverflowCandidate FindBufferOverflowCandidate () const ;
427
416
void PrintAddressDescription () const ;
428
417
void PrintHeapOrGlobalCandidate () const ;
@@ -447,6 +436,25 @@ class BaseReport {
447
436
OverflowCandidate candidate;
448
437
};
449
438
439
+ void BaseReport::CopyHeapChunk () {
440
+ HwasanChunkView chunk = FindHeapChunkByAddress (untagged_addr);
441
+ heap.begin = chunk.Beg ();
442
+ if (heap.begin ) {
443
+ heap.size = chunk.ActualSize ();
444
+ heap.from_small_heap = chunk.FromSmallHeap ();
445
+ heap.is_allocated = chunk.IsAllocated ();
446
+ }
447
+ }
448
+
449
+ void BaseReport::CopyStackAllocations () {
450
+ hwasanThreadList ().VisitAllLiveThreads ([&](Thread *t) {
451
+ if (stack_allocations_count < ARRAY_SIZE (stack_allocations) &&
452
+ t->AddrIsInStack (untagged_addr)) {
453
+ stack_allocations[stack_allocations_count++].CopyFrom (t);
454
+ }
455
+ });
456
+ }
457
+
450
458
BaseReport::OverflowCandidate BaseReport::FindBufferOverflowCandidate () const {
451
459
// Check if this looks like a heap buffer overflow by scanning
452
460
// the shadow left and right and looking for the first adjacent
0 commit comments