Arawoof06 opened a new pull request, #1380: URL: https://github.com/apache/arrow-java/pull/1380
## What's Changed `ArrowBuf.setBytes(long index, ByteBuffer src, int srcIndex, int length)` bounds-checks only the destination. When `src` is a direct buffer it copies `length` bytes from `getByteBufferAddress(src) + srcIndex` with `MemoryUtil.copyMemory`, so a source range past `src.capacity()` (or a negative `srcIndex`) silently copies adjacent native memory into the ArrowBuf, even with bounds checking enabled. For example, `buf.setBytes(0, ByteBuffer.allocateDirect(8), 0, 64)` succeeds. The heap path already rejects this through `ByteBuffer.position/limit`, and the `byte[]` and `ArrowBuf` overloads (and `NettyArrowBuf.setBytes(ByteBuf)`) check the source with `isOutOfBounds`. This adds the same source check before either path, so the `set/setSafe(int, ByteBuffer, int, int)` methods on the variable-width vectors fail with `IndexOutOfBoundsException` instead of reading out of bounds. Valid ranges behave as before. Added a regression test to `TestArrowBuf`. -- 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]
