From: Maoni Stephens Date: Fri, 8 Apr 2022 06:50:39 +0000 (-0700) Subject: need to check if the child obj is on an ro region (#67729) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~9879 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c093bb8f2a6f602943affbda995ce860ef25f494;p=platform%2Fupstream%2Fdotnet%2Fruntime.git need to check if the child obj is on an ro region (#67729) 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. --- diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 0b64b0c..a89bf11 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -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