ArrowBuf.setBytes(long, ByteBuffer, int, int) does not bounds-check the source buffer
Maintainer thường phản hồi trong vòng 1 ngày
@aryan9948 đang làm issue này rồi.
Từ ngày 8/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu với ArrowBuf.setBytes(long, ByteBuffer, int, int) và so sánh đường xử lý buffer trực tiếp với các overload lân cận có xác thực giới hạn nguồn. Thêm một bài kiểm thử hồi quy sử dụng buffer nguồn trực tiếp có phạm vi được yêu cầu vượt quá dung lượng, sau đó chạy các bài kiểm thử ArrowBuf liên quan. Hoàn tất khi phạm vi không hợp lệ bị từ chối và các thao tác sao chép hợp lệ vẫn thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug, including details regarding any error messages, version, and platform.
ArrowBuf.setBytes(long index, ByteBuffer src, int srcIndex, int length) bound-checks only the
destination (checkIndex(index, length)), never srcIndex/length against src. On the direct
branch it takes the raw buffer address, adds srcIndex, and calls
MemoryUtil.copyMemory(srcAddress, dstAddress, length), so a request whose srcIndex + length
runs past src.capacity() reads off-heap memory beyond the source buffer and copies it into the
ArrowBuf.
The heap branch of the same method rejects the identical request (newBuf.limit(srcIndex + length)
throws), and the sibling overloads all do an unconditional isOutOfBounds check on the other
buffer: setBytes(long, byte[], int, long), setBytes(long, ArrowBuf, long, long),
getBytes(long, byte[], int, int), getBytes(long, ArrowBuf, long, int) and
NettyArrowBuf.setBytes(int, ByteBuf, int, int). This overload is the only one in the family
without one.
Reproducer (bounds checking left at its default, i.e. enabled — the missing check is on the source
side, so BoundsChecking does not cover it):
ByteBuffer backing = ByteBuffer.allocateDirect(32);
for (int i = 0; i < 32; i++) {
backing.put(i, (byte) i);
}
ByteBuffer dup = backing.duplicate();
((Buffer) dup).position(0);
((Buffer) dup).limit(16);
ByteBuffer direct = dup.slice(); // isDirect=true, capacity=16
try (BufferAllocator allocator = new RootAllocator(128);
ArrowBuf buf = allocator.buffer(16)) {
buf.setBytes(0, direct, 8, 16); // asks for src[8, 24) from a 16-byte source
byte[] actual = new byte[16];
buf.getBytes(0, actual);
System.out.println(Arrays.toString(actual));
}
Output:
[8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
The last eight bytes (16..23) are outside the source buffer. The same call with a heap
ByteBuffer raises IllegalArgumentException: newLimit > capacity: (24 > 16), and
buf.setBytes(0, new byte[16], 8, 16) raises IndexOutOfBoundsException.
This overload backs set/setSafe(int, ByteBuffer, int, int) on BaseVariableWidthVector,
BaseLargeVariableWidthVector, BaseVariableWidthViewVector and BaseFixedWidthVector, which
pass start/length straight through, so the adjacent memory lands in vector data that is then
returned to callers or written out over IPC.
Component(s)
Java
- Ngôn ngữ chính
- Java
- Star
- 98
- Fork
- 160
- Merge trung bình
- 5 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/arrow-java
-
Flight SQL JDBC parses boolean properties case-sensitively, silently disabling TLS for useEncryption=TRUECó thể đã có người làm @Arawoof06 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
apache/arrow-java#1357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ArrowFlightJdbcArray.getArray(index, count) can read past the end of the array sliceCó thể đã có người làm @Arawoof06 đã nhận 85 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/arrow-java#1236 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Java][JDBC] ClobConsumer writes past VarCharVector data buffer for large CLOBsCó thể đã có người làm @Arawoof06 đã nhận 90 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/arrow-java#1230 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Java] DictionaryEncoder doesn't crash when decoding index outside of DictionaryCó thể đã có người làm @jakobhok-neo4j đã nhận 147 ngày trước. Đang mởType: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/arrow-java#1158 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apache/arrow-java#1100 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/arrow-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
objectionary/lints#1556 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
wildfly/wildfly-launcher#99 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
apache/rocketmq#11427 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
A failed JNA download is reported as a corrupt zip, because `curl` in `Makefile` lacks `--fail`Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
objectionary/phino#1884 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày