This is an automated email from the ASF dual-hosted git repository.

markt 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 5339a2457a Reset the HTTP/2 request header read buffer after a stream 
reset
5339a2457a is described below

commit 5339a2457ac2ee815a80c88e8c34b26d3261cf85
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Mar 23 16:08:33 2026 +0000

    Reset the HTTP/2 request header read buffer after a stream reset
---
 java/org/apache/coyote/http2/Http2Parser.java | 6 ++++++
 webapps/docs/changelog.xml                    | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index e5b59d8d92..5cb340efe1 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -305,6 +305,12 @@ class Http2Parser {
         long errorCode = ByteUtil.getFourBytes(payload, 0);
         output.reset(streamId, errorCode);
         headersCurrentStream = -1;
+        if (headerReadBuffer.capacity() > 
Constants.DEFAULT_HEADER_READ_BUFFER_SIZE) {
+            // Reset size for new request if the buffer was previously expanded
+            headerReadBuffer = 
ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
+        } else {
+            headerReadBuffer.clear();
+        }
         headersEndStream = false;
     }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b503e1ffa5..8eec2b88e8 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -233,6 +233,10 @@
         connection is closed. Pull request <pr>966</pr> provided by Phil Clay.
         (markt)
       </fix>
+      <fix>
+        Ensure the HTTP/2 request header read buffer is reset (including
+        restoration to default size) after a stream reset. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to