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

markt 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 9658d47526 Fix a rare NPE
9658d47526 is described below

commit 9658d47526244c56093429076b7171baf8e9ef53
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 8ea6078f67..482ca174b9 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 ddd4e49b4a..31df9c6198 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