Commit be94cfd
Fix ArgumentOutOfRangeException in IrishLowerCaseFilter span slicing, apache#1150 (apache#1286)
* Fix ArgumentOutOfRangeException in IrishLowerCaseFilter span slicing (apache#1150)
IrishLowerCaseFilter was incorrectly calculating the span length for
the lowercase operation. When the n-/t-prothesis path runs (inserting
a hyphen after 'n' or 't'), idx becomes 2 and the span length should
be (chLen - idx), not chLen. This caused out-of-bounds span creation.
The fix calculates spanLen = chLen - idx and uses this corrected
length for both the source and destination spans, as well as the spare
buffer allocation.
Added a regression test using a custom TightBufferTokenStream that
writes directly into CharTermAttribute.termBuffer to bypass the
Oversize over-allocation all public tokenizer paths use, producing a
buffer sized to exactly the post-prothesis term length. This reliably
triggers the ArgumentOutOfRangeException on the buggy code.
Fixes apache#1150
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add prothesis correctness tests for IrishLowerCaseFilter (apache#1150)
Tests all n-/t- prothesis combinations across plain and accented (fada)
upper vowels to guard against regressions in output correctness.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Address Copilot feedback
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b905052 commit be94cfd
2 files changed
Lines changed: 105 additions & 3 deletions
File tree
- src
- Lucene.Net.Analysis.Common/Analysis/Ga
- Lucene.Net.Tests.Analysis.Common/Analysis/Ga
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
Lines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
52 | 153 | | |
53 | 154 | | |
0 commit comments