ArrowFlightJdbcArray.getArray(index, count) can read past the end of the array slice
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in ArrowFlightJdbcArray.checkBoundaries e controlla entrambi i call site di getArray(index, count) e getResultSet(index, count). Aggiungi un test di regressione usando un startOffset diverso da zero, come lo slice di IntVector fornito, ed esegui i test ArrowFlightJdbcArray esistenti; il lavoro è completato quando le richieste non possono leggere oltre lo slice dell'array.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
ArrowFlightJdbcArray.checkBoundaries validates the caller-supplied index against startOffset + valuesCount:
private void checkBoundaries(long index, int count) {
if (index < 0 || index + count > this.startOffset + this.valuesCount) {
throw new ArrayIndexOutOfBoundsException();
}
}
but index is relative to the start of the array; both call sites add startOffset to it only afterwards, e.g.
checkBoundaries(index, count);
return getArrayNoBoundCheck(
this.dataVector, LargeMemoryUtil.checkedCastToInt(this.startOffset + index), count);
So the accepted range is too large by exactly startOffset elements, and getArray(index, count) / getResultSet(index, count) will read up to that far past the end of the row's slice.
AbstractArrowFlightJdbcListVectorAccessor builds these with the offsets of the list element being read, so any row of a list column that does not start at child offset 0 is affected. Reading within the element count the driver itself advertises then returns values belonging to other rows of the shared child vector, and past the child vector's valueCount it returns whatever is in allocated-but-unwritten memory.
Reproducer against an IntVector of 127 values, with an array covering elements 5..7:
ArrowFlightJdbcArray array = new ArrowFlightJdbcArray(dataVector, 5, 3);
array.getArray(1, 3); // accepted; returns elements 6, 7, 8 — element 8 is outside the array
Every existing test constructs the array with startOffset 0, where the wrong bound happens to coincide with the correct one, which is why this is not currently caught.
- Lingua principale
- Java
- Stelle
- 95
- Fork
- 154
- Merge medio
- 2g 16h
- PR unite (30g)
- 9
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/arrow-java
-
Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/arrow-java#1300 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
apache/arrow-java#1261 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/arrow-java#1230 ·
-
Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
apache/arrow-java#1205 ·
-
Type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/arrow-java#1196 · 1 commento ·
Tutte le issue di apache/arrow-java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
infinispan/infinispan#18150 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100