@@ -117,25 +117,25 @@ public void giveMultipleSegmentsThatGeneratesMultipleBufferFullErrorsThenIsAbleT
117117 @ Test
118118 public void givenMaliciousInputExtractDoesntOverflow () {
119119 assertEquals ("Xmx must equals to what's defined in the Gradle's javaTests task" ,
120- 12L * GB , Runtime .getRuntime ().maxMemory ());
120+ 10L * GB , Runtime .getRuntime ().maxMemory ());
121121
122122 // re-init the tokenizer with big sizeLimit
123123 initSUTWithSizeLimit ((int ) (2L * GB ) - 3 );
124124 // Integer.MAX_VALUE is 2 * GB
125- String bigFirstPiece = generateString ("a" , Integer .MAX_VALUE - 1024 );
126- sut .extract (context , RubyUtil . RUBY . newString ( bigFirstPiece ) );
125+ RubyString bigFirstPiece = generateString ("a" , Integer .MAX_VALUE - 1024 );
126+ sut .extract (context , bigFirstPiece );
127127
128128 // add another small fragment to trigger int overflow
129129 // sizeLimit is (2^32-1)-3 first segment length is (2^32-1) - 1024 second is 1024 +2
130- // so the combined length of first and second is > sizeLimit and should throw an expection
130+ // so the combined length of first and second is > sizeLimit and should throw an exception
131131 // but because of overflow it's negative and happens to be < sizeLimit
132132 Exception thrownException = assertThrows (IllegalStateException .class , () -> {
133- sut .extract (context , RubyUtil . RUBY . newString ( generateString ("a" , 1024 + 2 ) ));
133+ sut .extract (context , generateString ("a" , 1024 + 2 ));
134134 });
135135 assertThat (thrownException .getMessage (), containsString ("input buffer full" ));
136136 }
137137
138- private String generateString (String fill , int size ) {
139- return fill .repeat (size );
138+ private RubyString generateString (String fill , int size ) {
139+ return RubyUtil . RUBY . newString ( fill .repeat (size ) );
140140 }
141141}
0 commit comments