[ruby-core:127072] [Ruby Bug#22387] str_shared_replace incorrectly recalculates termlen