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 6c21ee5 Fix possible concurrency issue 6c21ee5 is described below commit 6c21ee5a57e6a6fa9c780d4a8f857d5c3a0b9a35 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Sep 15 17:34:50 2020 +0100 Fix possible concurrency issue --- java/org/apache/coyote/http11/Http11InputBuffer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java b/java/org/apache/coyote/http11/Http11InputBuffer.java index ab0d1c6..555e3ad 100644 --- a/java/org/apache/coyote/http11/Http11InputBuffer.java +++ b/java/org/apache/coyote/http11/Http11InputBuffer.java @@ -71,7 +71,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler /** * State. */ - private boolean parsingHeader; + private volatile boolean parsingHeader; /** @@ -130,7 +130,7 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler */ private byte prevChr = 0; private byte chr = 0; - private boolean parsingRequestLine; + private volatile boolean parsingRequestLine; private int parsingRequestLinePhase = 0; private boolean parsingRequestLineEol = false; private int parsingRequestLineStart = 0; @@ -266,18 +266,22 @@ public class Http11InputBuffer implements InputBuffer, ApplicationBufferHandler byteBuffer.limit(0).position(0); lastActiveFilter = -1; - parsingHeader = true; swallowInput = true; chr = 0; prevChr = 0; headerParsePos = HeaderParsePosition.HEADER_START; - parsingRequestLine = true; parsingRequestLinePhase = 0; parsingRequestLineEol = false; parsingRequestLineStart = 0; parsingRequestLineQPos = -1; headerData.recycle(); + // Recycled last because they are volatile + // All variables visible to this thread are guaranteed to be visible to + // any other thread once that thread reads the same volatile. The first + // action when parsing input data is to read one of these volatiles. + parsingRequestLine = true; + parsingHeader = true; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org