Support-itecz opened a new pull request, #1376:
URL: https://github.com/apache/arrow-java/pull/1376

   ## What's Changed
   
   `BaseFixedWidthVector.copyFrom` copies the value with a raw 
`MemoryUtil.copyMemory` from `from.getDataBuffer().memoryAddress() + fromIndex 
* typeWidth`, so neither the source nor the target buffer is bounds checked, 
even with bounds checking enabled. A fixed-width vector loaded from an IPC 
record batch whose field node length is larger than its data buffer (for 
example 4 int values over a 4-byte buffer) passes `isNull`. `copyFrom` / 
`copyFromSafe` / `TransferPair.copyValueSafe` on an index past the buffer then 
read native memory beyond it, while `get()` on the same index throws 
`IndexOutOfBoundsException`. In the new test the copied value is an int sitting 
8 bytes past the end of the data slice.
   
   The copy now goes through `ArrowBuf.getBytes(index, dst, dstIndex, length)`, 
which checks both buffers, the same way `BaseVariableWidthVector.copyFrom` 
already does. Copies of valid data are unchanged. 
`TestCopyFrom.testCopyFromFixedWidthSourceBufferTooShort` fails without the 
change and passes with it, and the `arrow-vector` and `arrow-algorithm` test 
suites pass locally along with spotless and checkstyle.
   


-- 
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