ArrowFlightJdbcArray.getArray(index, count) can read past the end of the array slice
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 78/100
Piste de recherche
Commencez dans ArrowFlightJdbcArray.checkBoundaries et inspectez les points d’appel de getArray(index, count) et de getResultSet(index, count). Ajoutez un test de régression utilisant un startOffset non nul, comme le slice IntVector fourni, et exécutez les tests ArrowFlightJdbcArray existants ; le travail est terminé lorsque les requêtes ne peuvent pas lire au-delà du slice du tableau.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Java
- Étoiles
- 95
- Forks
- 154
- Merge moyen
- 2 j 16 h
- PR mergées (30 j)
- 9
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/arrow-java
-
Type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/arrow-java#1300 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
apache/arrow-java#1261 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/arrow-java#1230 ·
-
Type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
apache/arrow-java#1205 ·
-
Type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/arrow-java#1196 · 1 commentaire ·
Toutes les issues de apache/arrow-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
infinispan/infinispan#18150 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
-
untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100