This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new bea3c3097f Add B2CConverter version of large buffer test
bea3c3097f is described below
commit bea3c3097f728e074c0a68cdec54e55133a6e3dd
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 1 10:20:33 2026 +0100
Add B2CConverter version of large buffer test
Test converted by GPT-5.5
---
test/org/apache/tomcat/util/buf/TestB2CConverter.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/test/org/apache/tomcat/util/buf/TestB2CConverter.java
b/test/org/apache/tomcat/util/buf/TestB2CConverter.java
index da65b65cdb..65504e86c1 100644
--- a/test/org/apache/tomcat/util/buf/TestB2CConverter.java
+++ b/test/org/apache/tomcat/util/buf/TestB2CConverter.java
@@ -22,6 +22,7 @@ import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.MalformedInputException;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import java.util.Locale;
import org.junit.Assert;
@@ -221,6 +222,23 @@ public class TestB2CConverter {
}
+ @Test
+ public void testOverflowWithLargeReadBuffer() throws Exception {
+ B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
+ byte[] bytes = new byte[10500];
+ Arrays.fill(bytes, (byte) '0');
+ ByteBuffer bb = ByteBuffer.wrap(bytes);
+ CharBuffer cb = newCharBuffer(InputBuffer.DEFAULT_BUFFER_SIZE);
+ TesterInputBuffer ib = new TesterInputBuffer(bb);
+
+ conv.convert(bb, cb, ib, false);
+
+ Assert.assertEquals(InputBuffer.DEFAULT_BUFFER_SIZE, cb.remaining());
+ Assert.assertEquals(InputBuffer.DEFAULT_BUFFER_SIZE, bb.position());
+ Assert.assertEquals(bytes.length - InputBuffer.DEFAULT_BUFFER_SIZE,
bb.remaining());
+ }
+
+
@Test
public void testLeftoverChunkWithTrailingBytes() throws Exception {
B2CConverter conv = new B2CConverter(StandardCharsets.UTF_8);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]