You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/10/01 09:21:48 UTC

[tomcat] branch master updated (e54267a -> 4e548a6)

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

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from e54267a  Fix 64735 ServletContext.addJspFile() always fails with SecurityManager
     new afa2730  Latest Eclipse/EasyMock no longer requires this
     new d9f9933  Refactor: remove unused parameter, separate frame create and frame write
     new 4e548a6  Fix BufferOverflowException reported on users list

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/tomcat/util/net/SocketBufferHandler.java    | 11 +++++++++++
 test/org/apache/catalina/realm/TestJNDIRealm.java      |  1 -
 test/org/apache/coyote/http2/Http2TestBase.java        | 18 ++++++++----------
 test/org/apache/coyote/http2/TestHttp2Section_6_8.java |  2 +-
 webapps/docs/changelog.xml                             |  5 +++++
 5 files changed, 25 insertions(+), 12 deletions(-)


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


[tomcat] 03/03: Fix BufferOverflowException reported on users list

Posted by ma...@apache.org.
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

commit 4e548a6daae6b5e9bb3ba48d238dedacccff4745
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 1 10:21:17 2020 +0100

    Fix BufferOverflowException reported on users list
---
 java/org/apache/tomcat/util/net/SocketBufferHandler.java | 11 +++++++++++
 webapps/docs/changelog.xml                               |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/java/org/apache/tomcat/util/net/SocketBufferHandler.java b/java/org/apache/tomcat/util/net/SocketBufferHandler.java
index d066240..78adf30 100644
--- a/java/org/apache/tomcat/util/net/SocketBufferHandler.java
+++ b/java/org/apache/tomcat/util/net/SocketBufferHandler.java
@@ -27,6 +27,17 @@ public class SocketBufferHandler {
         @Override
         public void expand(int newSize) {
         }
+        /*
+         * Http2AsyncParser$FrameCompletionHandler will return incomplete
+         * frame(s) to the buffer. If the previous frame (or concurrent write to
+         * a stream) triggered a connection close this call would fail with a
+         * BufferOverflowException as data can't be returned to a buffer of zero
+         * length. Override the method and make it a NO-OP to avoid triggering
+         * the exception.
+         */
+        @Override
+        public void unReadReadBuffer(ByteBuffer returnedData) {
+        }
     };
 
     private volatile boolean readBufferConfiguredForWrite = true;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index bf5b40c..3d62382 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -141,6 +141,11 @@
         Don't send the Keep-Alive response header if the connection has been
         explicitly closed. (markt)
       </fix>
+      <fix>
+        Avoid a <code>BufferOverflowException</code> if an HTTP/2 connection is
+        closed while the parser still has a partial HTTP/2 frame in the input
+        buffer. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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


[tomcat] 01/03: Latest Eclipse/EasyMock no longer requires this

Posted by ma...@apache.org.
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

commit afa2730a4db02c6cbc7a8542d52b560cc0b0e40b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 1 09:16:41 2020 +0100

    Latest Eclipse/EasyMock no longer requires this
---
 test/org/apache/catalina/realm/TestJNDIRealm.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/org/apache/catalina/realm/TestJNDIRealm.java b/test/org/apache/catalina/realm/TestJNDIRealm.java
index 6a1814c..c729be8 100644
--- a/test/org/apache/catalina/realm/TestJNDIRealm.java
+++ b/test/org/apache/catalina/realm/TestJNDIRealm.java
@@ -138,7 +138,6 @@ public class TestJNDIRealm {
 
     private NamingEnumeration<SearchResult> mockSearchResults(String password)
             throws NamingException {
-        @SuppressWarnings("unchecked")
         NamingEnumeration<SearchResult> searchResults =
                 EasyMock.createNiceMock(NamingEnumeration.class);
         EasyMock.expect(Boolean.valueOf(searchResults.hasMore()))


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


[tomcat] 02/03: Refactor: remove unused parameter, separate frame create and frame write

Posted by ma...@apache.org.
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

commit d9f9933c2c2b8b8b4226ff23bdc31ae16838ba0f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 1 10:18:01 2020 +0100

    Refactor: remove unused parameter, separate frame create and frame write
---
 test/org/apache/coyote/http2/Http2TestBase.java        | 18 ++++++++----------
 test/org/apache/coyote/http2/TestHttp2Section_6_8.java |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/test/org/apache/coyote/http2/Http2TestBase.java b/test/org/apache/coyote/http2/Http2TestBase.java
index 167fd94..807c4a5 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -813,14 +813,9 @@ public abstract class Http2TestBase extends TomcatBaseTest {
     }
 
 
-    void sendGoaway(int streamId, int lastStreamId, long errorCode, byte[] debug)
-            throws IOException {
+    byte[] buildGoaway(int streamId, int lastStreamId, long errorCode) {
         byte[] goawayFrame = new byte[17];
-        int len = 8;
-        if (debug != null) {
-            len += debug.length;
-        }
-        ByteUtil.setThreeBytes(goawayFrame, 0, len);
+        ByteUtil.setThreeBytes(goawayFrame, 0, 8);
         // Type
         goawayFrame[3] = FrameType.GOAWAY.getIdByte();
         // No flags
@@ -829,10 +824,13 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         // Last stream
         ByteUtil.set31Bits(goawayFrame, 9, lastStreamId);
         ByteUtil.setFourBytes(goawayFrame, 13, errorCode);
+        return goawayFrame;
+    }
+
+
+    void sendGoaway(int streamId, int lastStreamId, long errorCode) throws IOException {
+        byte[] goawayFrame = buildGoaway(streamId, lastStreamId, errorCode);
         os.write(goawayFrame);
-        if (debug != null && debug.length > 0) {
-            os.write(debug);
-        }
         os.flush();
     }
 
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
index c43a0b5..b80b1a9 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_6_8.java
@@ -76,7 +76,7 @@ public class TestHttp2Section_6_8 extends Http2TestBase {
         // HTTP2 upgrade
         http2Connect();
 
-        sendGoaway(1, 1, Http2Error.NO_ERROR.getCode(), null);
+        sendGoaway(1, 1, Http2Error.NO_ERROR.getCode());
 
         handleGoAwayResponse(1);
     }


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