need to check if the child obj is on an ro region (#67729)
authorMaoni Stephens <Maoni0@users.noreply.github.com>
Fri, 8 Apr 2022 06:50:39 +0000 (23:50 -0700)
committerGitHub <noreply@github.com>
Fri, 8 Apr 2022 06:50:39 +0000 (23:50 -0700)
when we check if a card is needed, we need to check if the child obj is in an ro region before getting its gen_num since there's no region data structure for it.

src/coreclr/gc/gc.cpp

index 0b64b0c..a89bf11 100644 (file)
@@ -43062,7 +43062,7 @@ BOOL gc_heap::check_need_card (uint8_t* child_obj, int gen_num_for_cards,
                                uint8_t* low, uint8_t* high)
 {
 #ifdef USE_REGIONS
-    return (get_region_gen_num (child_obj) < gen_num_for_cards);
+    return (is_in_heap_range (child_obj) && (get_region_gen_num (child_obj) < gen_num_for_cards));
 #else
     return ((child_obj < high) && (child_obj >= low));
 #endif //USE_REGIONS