From aa86c2b8a0491061a43649cd6ad9a228b781407a Mon Sep 17 00:00:00 2001 From: Luca Cavanna Date: Thu, 12 Sep 2024 13:08:44 +0200 Subject: [PATCH] Address length used to copy array in FacetsCollector to not be out of bounds (#13774) This has caused a few recent test failures with jdk23 and jdk24. It should get fixed replacing the length with the lengt of the array, rather than using the new length. --- .../facet/src/java/org/apache/lucene/facet/FacetsCollector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java b/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java index e17562a2063..11ccec5ca1b 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java @@ -84,7 +84,7 @@ public class FacetsCollector extends SimpleCollector { if (keepScores) { if (doc >= scores.length) { float[] newScores = new float[ArrayUtil.oversize(doc + 1, 4)]; - System.arraycopy(scores, 0, newScores, 0, doc); + System.arraycopy(scores, 0, newScores, 0, scores.length); scores = newScores; } scores[doc] = scorer.score();