Ankou76ers opened a new issue, #12210:
URL: https://github.com/apache/lucene/issues/12210

   ### Description
   
   When calling [preceding 
](https://github.com/apache/lucene/blob/0782535017c9e737350e96fb0f53457c7b8ecf03/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L136)
 function from 
[OpenNLPSentenceBreakIterator](https://github.com/apache/lucene/blob/main/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java)
 it may raise an ArrayIndexOutOfBoundsException.
   
   The "start search from the middle" computation seems wrong:
   
   ```java
   currentSentence = sentenceStarts.length / 2; // start search from the middle
   ```
   
   It should be instead (like in 
[following](https://github.com/apache/lucene/blob/0782535017c9e737350e96fb0f53457c7b8ecf03/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L75)
 function):
   
    ```java
   currentSentence = (sentenceStarts.length -1) / 2; // start search from the 
middle
   ```
   
   Otherwise when sentenceStarts.length == 2 we get currentSentence equals 1 
and possibly an ArrayIndexOutOfBoundsException later in the 
[moveToSentenceAt](https://github.com/apache/lucene/blob/0782535017c9e737350e96fb0f53457c7b8ecf03/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L97)
 function.
   
   
   
   ### Version and environment details
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to