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