The `CurvesGeometry::resize` function would not work properly when
passing a new size of zero.
1) The `CustomData_realloc` would allocate an array with zero size.
2) A new size of 1 is passed to `implicit_sharing::resize_trivial_array`
for the curve offsets when it should pass 0.
3) A value is written out-of-bounds to `curve_offsets`
This fixes the issues in the following ways:
1) `CustomData_realloc` now doesn't allocate any data when the new
size is 0 and sets the `layer->data` to `nullptr`.
2) When the new number of curves is 0, resize the `curve_offsets` to 0
not to 1. This also ensures that the data pointer is `nullptr`.
3) Make sure to only write the first and last curve offset when the
number of curves is greater than 0.
Pull Request: https://projects.blender.org/blender/blender/pulls/141333