FiV0 opened a new issue, #39554:
URL: https://github.com/apache/arrow/issues/39554

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   The following throws with `java.lang.IndexOutOfBoundsException: index: 0, 
length: 4 (expected: range(0, 0))`
   ```java
   package org.apache.arrow.vector;
   
   import org.apache.arrow.memory.RootAllocator;
   import org.apache.arrow.vector.complex.ListVector;
   import org.apache.arrow.vector.util.TransferPair;
   import org.junit.jupiter.api.Test;
   
   import static org.junit.Assert.assertEquals;
   
   
   public class ListVectorIOBTest {
   
       @Test
       void shouldNotThrow()  {
           RootAllocator allocator = new RootAllocator();
           ListVector listVector = ListVector.empty("foo", allocator);
   
           TransferPair transferPair = listVector.getTransferPair(allocator);
           transferPair.splitAndTransfer(0,0);
           assertEquals(null, transferPair.getTo());
   
       }
   
   }
   ```
   Tested against the `14.0.2`  tag.
   
   I think the test condition here 
https://github.com/apache/arrow/blob/e7ab540ed9901d19ebde81f43e8417562ef8a334/java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java#L316
 is not correct for `index = 0` and `capacity = 0`.
   
   
   ### Component(s)
   
   Java


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to