Closed
Description
Describe the bug
I introduced a regression with #6805 that causes the writer to panic if the offset slice is zero and the slice length * 2 is within the end of the original array.
To Reproduce
Example code which reproduces the error:
let mut ls = GenericListBuilder::<i32, _>::new(UInt32Builder::new());
// ls = [[], [35, 42]
ls.append(true);
ls.values().append_value(35);
ls.values().append_value(42);
ls.append(true);
let original_list = ls.finish();
let original_data = original_list.into_data();
let slice_data = original_data.slice(1, 1);
let (new_offsets, original_start, length) = reencode_offsets::<i32>(&slice_data.buffers()[0], &slice_data);
// panic
Expected behavior
Code shouldn't panic and should return the slices.
Additional context
Pull request incoming. The code is just making the slice twice as large as it should.