This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new dc07454147 Refactor hpackDecoder as a final field
dc07454147 is described below
commit dc07454147a7ca175b48e156f1ce9e5556aaebc0
Author: remm <[email protected]>
AuthorDate: Tue May 19 21:33:26 2026 +0200
Refactor hpackDecoder as a final field
It is almost always used and it's more robust.
BZ70050
---
java/org/apache/coyote/http2/Http2Parser.java | 6 ++----
webapps/docs/changelog.xml | 4 ++++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2Parser.java
b/java/org/apache/coyote/http2/Http2Parser.java
index c956dd52d4..e124732236 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -45,8 +45,8 @@ class Http2Parser {
protected final Input input;
private final Output output;
private final byte[] frameHeaderBuffer = new byte[9];
+ private final HpackDecoder hpackDecoder;
- private volatile HpackDecoder hpackDecoder;
private volatile ByteBuffer headerReadBuffer =
ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
private volatile int headersCurrentStream = -1;
private volatile boolean headersEndStream = false;
@@ -55,6 +55,7 @@ class Http2Parser {
this.connectionId = connectionId;
this.input = input;
this.output = output;
+ this.hpackDecoder = output.getHpackDecoder();
}
@@ -246,9 +247,6 @@ class Http2Parser {
headersEndStream = Flags.isEndOfStream(flags);
- if (hpackDecoder == null) {
- hpackDecoder = output.getHpackDecoder();
- }
try {
hpackDecoder.setHeaderEmitter(output.headersStart(streamId,
headersEndStream));
} catch (StreamException se) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 00188a9dd4..e7cfd9c0ad 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,10 @@
<fix>
Improve enforcement of header trailer allow list for HTTP/2. (remm)
</fix>
+ <fix>
+ <bug>70050</bug>: Avoid NPE when no header frame is processed in
HTTP/2,
+ following refactor clean-up of header buffer. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Cluster">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]