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

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 64941cbcae Fix a rare NPE
64941cbcae is described below

commit 64941cbcae62a0a1ee2d5de58c1a637ec162b3ff
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 19 15:44:18 2024 +0000

    Fix a rare NPE
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 5 ++++-
 webapps/docs/changelog.xml                           | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 689885edb4..6ac98ad88d 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -259,7 +259,10 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler
             activeFilters[i].recycle();
         }
 
-        byteBuffer.limit(0).position(0);
+        // Avoid rare NPE reported on users@ list
+        if (byteBuffer != null) {
+            byteBuffer.limit(0).position(0);
+        }
         lastActiveFilter = -1;
         swallowInput = true;
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b45debc818..b983b43c0c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,6 +124,10 @@
         Don't log warnings for registered HTTP/2 settings that Tomcat does not
         support. These settings are now silently ignored. (markt)
       </fix>
+      <fix>
+        Avoid a rare <code>NullPointerException</code> when recycling the
+        <code>Http11InputBuffer</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to