BUG: Fixed a bug with setting invalid or out-of-range values in indexing
     enlargement scenarios (GH4940)