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