This is an automated email from the ASF dual-hosted git repository. markt-asf pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 95b34dadddb9d65d72fa2f3603132f80549399ed 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 06b4da7825..e5edf0bf2d 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]
