This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 2cc05facdb Add B2CConverter version of large buffer test
2cc05facdb is described below
commit 2cc05facdbf65391c7940b0bebc57a2c8ea2739b
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 8676fce0c0..c826aef1fc 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]