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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 8bb769f  BZ 64660. Avoid NPE in APREndpoint.
8bb769f is described below

commit 8bb769f2523cae333b66d907413ee10bf45f320c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Sun Aug 16 16:26:18 2020 +0100

    BZ 64660. Avoid NPE in APREndpoint.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 5 +++++
 webapps/docs/changelog.xml                       | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 342502b..cb777f5 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -740,6 +740,11 @@ public class AprEndpoint extends AbstractEndpoint<Long> 
implements SNICallBack {
      */
     protected boolean processSocket(long socket, SocketEvent event) {
         SocketWrapperBase<Long> socketWrapper = 
connections.get(Long.valueOf(socket));
+        if (socketWrapper == null) {
+            // Socket probably closed from another thread. Triggering another
+            // close in case won't cause an issue.
+            return false;
+        }
         return processSocket(socketWrapper, event, true);
     }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a3bc25e..8391c00 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -89,6 +89,11 @@
         Avoid several potential NPEs introduced in the changes in the previous
         release to reduce the memory footprint of closed HTTP/2 streams. 
(markt)
       </fix>
+      <fix>
+        <bug>64660</bug>: Avoid a potential NPE in the AprEndpoint if a socket
+        is closed in one thread at the same time as the poller is processing an
+        event for that socket in another. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">


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

Reply via email to