Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix out-of-slice read in ArrowFlightJdbcArray.checkBoundaries
  • Loading branch information
Arawoof06 committed Aug 25, 2026
commit 1b1a4f9a7f4c4b46c01a7c05a8fd5289d538f346
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Object getArray(long index, int count) throws SQLException {
}

private void checkBoundaries(long index, int count) {
if (index < 0 || index + count > this.startOffset + this.valuesCount) {
if (index < 0 || index + count > this.valuesCount) {
throw new ArrayIndexOutOfBoundsException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ public void testShouldGetArrayWithOffsetsThrowArrayIndexOutOfBoundsException()
() -> arrowFlightJdbcArray.getArray(0, dataVector.getValueCount() + 1));
}

@Test
public void testShouldGetArrayWithOffsetsNotReadPastEndOfSlice() throws SQLException {
// Array covering elements 5, 6 and 7 of the underlying vector.
ArrowFlightJdbcArray arrowFlightJdbcArray = new ArrowFlightJdbcArray(dataVector, 5, 3);
assertThrows(ArrayIndexOutOfBoundsException.class, () -> arrowFlightJdbcArray.getArray(1, 3));
}

@Test
public void testShouldGetResultSetWithOffsetsNotReadPastEndOfSlice() throws SQLException {
ArrowFlightJdbcArray arrowFlightJdbcArray = new ArrowFlightJdbcArray(dataVector, 5, 3);
assertThrows(
ArrayIndexOutOfBoundsException.class, () -> arrowFlightJdbcArray.getResultSet(1, 3));
}

@Test
public void testShouldGetArrayWithMapNotBeSupported() throws SQLException {
ArrowFlightJdbcArray arrowFlightJdbcArray =
Expand Down
Loading