File tree 2 files changed +19
-1
lines changed
main/java/org/codehaus/plexus/util/xml/pull
test/java/org/codehaus/plexus/util/xml/pull
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3656,7 +3656,8 @@ else if ( expand )
3656
3656
buf = newBuf ;
3657
3657
if ( bufLoadFactor > 0 )
3658
3658
{
3659
- bufSoftLimit = ( bufLoadFactor * buf .length ) / 100 ;
3659
+ // Include fix for https://web.archive.org/web/20070831191548/http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=228
3660
+ bufSoftLimit = (int ) ((((long ) bufLoadFactor ) * buf .length ) / 100 );
3660
3661
}
3661
3662
3662
3663
}
Original file line number Diff line number Diff line change @@ -391,6 +391,23 @@ public void testSubsequentProcessingInstructionMoreThan8k()
391
391
assertEquals ( XmlPullParser .END_TAG , parser .nextToken () );
392
392
}
393
393
394
+ @ Test
395
+ public void testFillBuf_NoOverflow ()
396
+ throws Exception
397
+ {
398
+ MXParser parser = new MXParser ();
399
+ parser .reader = new StringReader ("testFillBuf_NoOverflow" );
400
+ parser .bufEnd = 15941364 ;
401
+ parser .buf = new char [16777216 ];
402
+
403
+ parser .fillBuf ();
404
+
405
+ // Without this fix
406
+ // https://web.archive.org/web/20070831191548/http://www.extreme.indiana.edu/bugzilla/show_bug.cgi?id=228
407
+ // the integer value overflows to -11072962
408
+ assertTrue (parser .bufSoftLimit >= 0 );
409
+ }
410
+
394
411
public void testMalformedProcessingInstructionAfterTag ()
395
412
throws Exception
396
413
{
You can’t perform that action at this time.
0 commit comments