SI-7880 Fix infinite loop in ResizableArray#ensureSize

This issue was triggered for values greater than Int.MaxValue/2, which
caused the computation of the new array size to overflow and become
negative, leading to an infinite loop.