Fix soundness issue for replace_range
and range
#81169
Merged
replace_range
and range
#81169