apache / apache/lucene

UnescapedCharSequence.toLowerCase throws ArrayIndexOutOfBoundsException for certain input strings [LUCENE-6358]

Open
#7,419 3 comments 0 reactions 0 assignees View on GitHub
affects-version:5.0 legacy-jira-priority:Minor module:queryparser type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The static toLowerCase-method of UnescapedCharSequence does not account for locales in which the length of the result of String.toLowerCase is not the same as the length of the input string. This causes an ArrayIndexOutOfBoundsException, because wasEscaped and the chars array are not of the same length.
(See attached test and patch)

---
Migrated from [LUCENE-6358](https://issues.apache.org/jira/browse/LUCENE-6358) by Christoph Kaser, updated Mar 13 2019
Attachments: [LUCENE-6358-fix.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-6358/LUCENE-6358-fix.patch), [LUCENE-6358-test.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-6358/LUCENE-6358-test.patch)

Contributor guide

Open the contributing guide

Research direction

Locate UnescapedCharSequence.toLowerCase and read the attached LUCENE-6358 fix and test patches first. Reproduce the locale-dependent input that produces different output and input lengths, then run the relevant Lucene tests to confirm the exception is fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.