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