You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2024/09/12 11:21:54 UTC

(lucene) branch branch_9x updated: Address length used to copy array in FacetsCollector to not be out of bounds (#13774)

This is an automated email from the ASF dual-hosted git repository.

javanna pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 35b219a1327 Address length used to copy array in FacetsCollector to not be out of bounds (#13774)
35b219a1327 is described below

commit 35b219a1327d1c1fa8b415e06e4619095879264d
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Thu Sep 12 13:08:44 2024 +0200

    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.
---
 lucene/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 7bffee702c8..51a959beebe 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java
@@ -112,7 +112,7 @@ public class FacetsCollector extends SimpleCollector {
     if (keepScores) {
       if (totalHits >= scores.length) {
         float[] newScores = new float[ArrayUtil.oversize(totalHits + 1, 4)];
-        System.arraycopy(scores, 0, newScores, 0, totalHits);
+        System.arraycopy(scores, 0, newScores, 0, scores.length);
         scores = newScores;
       }
       scores[totalHits] = scorer.score();