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 e380f5caca Fix a rare NPE
e380f5caca is described below

commit e380f5caca9c5430293c2dd3523430cbf2e5007a
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 2e6d0e885a..13a174c480 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -250,7 +250,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 d3f26bcbd7..5a501e89cc 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -162,6 +162,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>
   <subsection name="Jasper">


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

Reply via email to