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