Skip to content

Commit 99dbb90

Browse files
github-actions[bot]Maoni0
andauthored
throw an exception instead of infinite loop (#115528)
Co-authored-by: Maoni0 <[email protected]>
1 parent 7136ea2 commit 99dbb90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10687,6 +10687,14 @@ size_t gc_heap::sort_mark_list()
1068710687
size_t region_index = get_basic_region_index_for_address (heap_segment_mem (region));
1068810688
uint8_t* region_limit = heap_segment_allocated (region);
1068910689

10690+
// Due to GC holes, x can point to something in a region that already got freed. And that region's
10691+
// allocated would be 0 and cause an infinite loop which is much harder to handle on production than
10692+
// simply throwing an exception.
10693+
if (region_limit == 0)
10694+
{
10695+
FATAL_GC_ERROR();
10696+
}
10697+
1069010698
uint8_t*** mark_list_piece_start_ptr = &mark_list_piece_start[region_index];
1069110699
uint8_t*** mark_list_piece_end_ptr = &mark_list_piece_end[region_index];
1069210700
#else // USE_REGIONS

0 commit comments

Comments
 (0)