Possible regression after upgrade to [9.0.119] (java.lang.IllegalArgumentException: newPosition > limit: (8175 > 9))

"Stankov. Yavor" <[email protected]> Fri, 26 Jun 2026 06:57:30 +0000
Newsgroups gmane.comp.jakarta.tomcat.user
Message-ID <PA1P189MB31453ECE9CFDB782B3B4849BFEEB2@PA1P189MB3145.EURP189.PROD.OUTLOOK.COM>
--_000_PA1P189MB31453ECE9CFDB782B3B4849BFEEB2PA1P189MB3145EURP_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

I'm investigating what appears to be a possible regression after upgrading =
Tomcat from 9.0.118 (working) to 9.0.119.

Environment:

  *   Apache Tomcat 9.0.119
  *   Java 21
  *   Running inside Apache Karaf

After the upgrade, one of our release pipeline tests consistently fails whi=
le reading the body of an HTTP POST request.

The exception is:
java.lang.IllegalArgumentException: newPosition > limit: (8175 > 9)
    at java.base/java.nio.Buffer.createPositionException(Buffer.java:352)
    at java.base/java.nio.Buffer.position(Buffer.java:327)
    at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1551)
    at org.apache.tomcat.util.buf.B2CConverter.convert(B2CConverter.java:30=
0)
    at org.apache.catalina.connector.InputBuffer.realReadChars(InputBuffer.=
java:485)
    at org.apache.catalina.connector.InputBuffer.checkCharBufferEof(InputBu=
ffer.java:691)
    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:517)
    at org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:10=
8)
    ...

The application code is simply:

private String loadXMLContent(HttpServletRequest request) throws IOExceptio=
n {
    StringBuffer crBuff =3D new StringBuffer();

    try (Reader reader =3D request.getReader()) {
        char[] chBuff =3D new char[500];
        int charsNumber;

        while ((charsNumber =3D reader.read(chBuff)) !=3D -1) {
            crBuff.append(chBuff, 0, charsNumber);
        }
    }

    return crBuff.toString();
}

The exception is thrown from reader.read(...);  there is no custom bufferin=
g or manipulation of the request stream.

The request body is XML and is normally processed without problems on the p=
revious Tomcat version.

I'd like to ask:

  1.  Has anyone seen a similar IllegalArgumentException originating from B=
2CConverter / InputBuffer after upgrading to 9.0.119?
  2.  Are there any known changes in the request body decoding path that co=
uld explain this behavior?
  3.  Is there any additional logging or diagnostics you would recommend to=
 determine whether this is a Tomcat issue or an application/environment iss=
ue?

Best Regards,
Yavor Stankov








SEEBURGER AG            Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:                Axel Haas, Michael =
Kleeberg, Dr. Martin Kuntz
Edisonstr. 1
D-75015 Bretten         Vorsitzende des Aufsichtsrats/Chairperson of the SE=
EBURGER Supervisory Board:
Tel.: 07252 / 96 - 0            Prof. Dr. Simone Zeuchner-Egli
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de               Registergericht/Commercial =
Register:
e-mail: [email protected]               HRB 240708 Mannheim

Hinweis: Diese Nachricht ist vertraulich und nur f?r den Empf?nger bestimmt=
. Wenn Sie sie irrt?mlich erhalten haben, informieren Sie bitte den Absende=
r und l?schen Sie die Nachricht. Keine Haftung f?r Sch?den durch Viren oder=
 Manipulationen - bitte pr?fen Sie Anh?nge vor dem ?ffnen. Informationen zu=
r Verarbeitung personenbezogener Daten:Datenschutzhinweise f?r Gesch?ftspar=
tner<https://www.seeburger.com/fileadmin/noIndex/legal/SEEBURGER_Datenschut=
zhinweise_Geschaeftspartner_DE.pdf>

Notice: This message is confidential and intended only for the recipient. I=
f received in error, please notify the sender and delete it. No liability f=
or damages caused by viruses or manipulation - please scan attachments befo=
re opening. Information on personal data processing:Privacy Notice for Busi=
ness Partners<https://www.seeburger.com/fileadmin/noIndex/legal/SEEBURGER_P=
rivacy_Notice_Business_Partners_EN.pdf>

--_000_PA1P189MB31453ECE9CFDB782B3B4849BFEEB2PA1P189MB3145EURP_--