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

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


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

commit 31ae6da4ec78c2aa3eae952f203a9f29be5e779f
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 1be5e1afa2..3813dfa7f5 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