Skip to content

Commit fee2cf8

Browse files
throw an exception instead of infinite loop (#115529)
1 parent 331ddf9 commit fee2cf8

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
@@ -10717,6 +10717,14 @@ size_t gc_heap::sort_mark_list()
1071710717
size_t region_index = get_basic_region_index_for_address (heap_segment_mem (region));
1071810718
uint8_t* region_limit = heap_segment_allocated (region);
1071910719

10720+
// Due to GC holes, x can point to something in a region that already got freed. And that region's
10721+
// allocated would be 0 and cause an infinite loop which is much harder to handle on production than
10722+
// simply throwing an exception.
10723+
if (region_limit == 0)
10724+
{
10725+
FATAL_GC_ERROR();
10726+
}
10727+
1072010728
uint8_t*** mark_list_piece_start_ptr = &mark_list_piece_start[region_index];
1072110729
uint8_t*** mark_list_piece_end_ptr = &mark_list_piece_end[region_index];
1072210730
#else // USE_REGIONS

0 commit comments

Comments
 (0)