@@ -93,23 +93,16 @@ public virtual void TestProthesisCorrectness()
9393 /// <summary>
9494 /// Regression test for issue #1150: ArgumentOutOfRangeException in IrishLowerCaseFilter.
9595 ///
96- /// The bug: when the n-/t-prothesis path runs, idx is set to 2 but the span length was
97- /// left as chLen (full term length) instead of chLen - idx. This creates a span that reads
98- /// chArray[idx .. idx+chLen], which exceeds the buffer when the buffer is sized just large
99- /// enough for chLen chars.
100- ///
101- /// We reproduce by using a custom TokenStream that writes directly into the internal
102- /// CharTermAttributeImpl.termBuffer field, bypassing the Oversize over-allocation that
96+ /// We confirm this is fixed by using a custom TokenStream that writes directly into the
97+ /// internal CharTermAttribute.termBuffer field, bypassing the Oversize over-allocation that
10398 /// all public paths go through, so the buffer is sized to exactly the post-prothesis
104- /// term length. The buggy code then asks for chArray[2..2+chLen] which is 2 chars past
105- /// the end.
99+ /// term length. Any out-of-range access would throw an exception and fail the test.
106100 /// </summary>
107101 [ Test , LuceneNetSpecific ] // Issue #1150
108- public virtual void TestProthesis_SpanBoundaryThrows ( )
102+ public virtual void TestProthesis_SpanBoundary ( )
109103 {
110104 // "nAthair" has length 7; after prothesis it becomes "n-athair" (length 8).
111- // We pre-size the buffer to exactly 8 so that chArray[2..2+8] = chArray[2..10]
112- // exceeds the buffer and throws ArgumentOutOfRangeException on the buggy code.
105+ // We pre-size the buffer to exactly 8 so that we can detect out-of-range access.
113106 const string input = "nAthair" ;
114107 const string expected = "n-athair" ;
115108
@@ -121,16 +114,16 @@ public virtual void TestProthesis_SpanBoundaryThrows()
121114 /// <summary>
122115 /// A TokenStream that emits a single token with the backing buffer sized to exactly
123116 /// the post-prothesis term length (term.Length + 1), bypassing Oversize over-allocation.
124- /// This forces the tight-buffer condition that triggers the span length bug in
125- /// IrishLowerCaseFilter when idx=2 and spanLen is incorrectly computed as chLen .
117+ /// This forces the tight-buffer condition that could detect span length bugs in
118+ /// IrishLowerCaseFilter.
126119 /// </summary>
127120 private sealed class TightBufferTokenStream : TokenStream
128121 {
129122 private readonly string _term ;
130123 private bool _done ;
131124 private readonly CharTermAttribute _termAtt ;
132125
133- public TightBufferTokenStream ( string term ) : base ( )
126+ public TightBufferTokenStream ( string term )
134127 {
135128 _term = term ;
136129 _termAtt = ( CharTermAttribute ) AddAttribute < ICharTermAttribute > ( ) ;
0 commit comments