This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 919ab5e BZ 64660. Avoid NPE in APREndpoint.
919ab5e is described below
commit 919ab5e1c150f6cbe4098d404f91a91b8ec3c591
Author: Mark Thomas <[email protected]>
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 004f7a7..b1aa119 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -711,6 +711,11 @@ public class AprEndpoint extends
AbstractEndpoint<Long,Long> implements SNICallB
*/
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;
+ }
if (event == SocketEvent.OPEN_READ && socketWrapper.readOperation !=
null) {
return socketWrapper.readOperation.process();
} else if (event == SocketEvent.OPEN_WRITE &&
socketWrapper.writeOperation != null) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c6c72a0..e0f75a1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,6 +104,11 @@
stops when a connector is started immediately after it is stopped.
(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: [email protected]
For additional commands, e-mail: [email protected]