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 73ee876 Fix possible concurrency issue 73ee876 is described below commit 73ee8766e89df8afd5655441d5535dd115256773 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 3ed3f20..728242e 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; @@ -281,18 +281,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