Resize array in case of out-of-bounds reading