From 501a398983b5f0f03e1f4f6c934e5e085fe1c07ff9aa60a39598b5ba1640f04f Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 25 Feb 2020 13:35:13 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/tomcat?expand=0&rev=190 --- apache-tomcat-9.0.30-src.tar.gz | 3 - apache-tomcat-9.0.30-src.tar.gz.asc | 16 - apache-tomcat-9.0.31-src.tar.gz | 3 + apache-tomcat-9.0.31-src.tar.gz.asc | 16 + ...t.patch => tomcat-9.0.31-java8compat.patch | 892 ++++++++---------- tomcat.changes | 14 + tomcat.spec | 4 +- 7 files changed, 430 insertions(+), 518 deletions(-) delete mode 100644 apache-tomcat-9.0.30-src.tar.gz delete mode 100644 apache-tomcat-9.0.30-src.tar.gz.asc create mode 100644 apache-tomcat-9.0.31-src.tar.gz create mode 100644 apache-tomcat-9.0.31-src.tar.gz.asc rename tomcat-9.0.30-java8compat.patch => tomcat-9.0.31-java8compat.patch (79%) diff --git a/apache-tomcat-9.0.30-src.tar.gz b/apache-tomcat-9.0.30-src.tar.gz deleted file mode 100644 index a8f720c..0000000 --- a/apache-tomcat-9.0.30-src.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:073bf0a56738d9bcb70c6065077495506b41dcea26731f0599c701efb90dc4ba -size 5798307 diff --git a/apache-tomcat-9.0.30-src.tar.gz.asc b/apache-tomcat-9.0.30-src.tar.gz.asc deleted file mode 100644 index aa24d18..0000000 --- a/apache-tomcat-9.0.30-src.tar.gz.asc +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEEqcXfTSLpmZjZh1pREMAcWi9gWecFAl3r2Q8ACgkQEMAcWi9g -WefsBg/8CwNTI+JvM9pVcD7I3QzHjZJ61JMkf/cmgTvuDbWHCIlWiXqXEd5NcizF -yuC1lg+8JotS+ZK5puOlZRzfX1W9sQ0ry6namKb6msj/czcgAQUVMIRC8ezjAlHe -4pyweTv1bBVnL5zyvQr/f4344i/hzwR0PBFeNu2dAXp7Hs1E4nMDNi8j0RrNUF3s -8WmIH+TxlNAJ0efc7T0NkQ3UbbOyuqDeAhAFlcFgZny/91JjAEJNs/ne1KXFZ2kK -cyTOf03TBmz4HjNtQBTE7S8r1ZKGU1PJumivPnUToKgdBUf3SWiF3m3ywYXhbOIs -OkME+Ru1Sx8M87fvqTf7qxgIaMk1DtTqqyG4K9bkhaDvnGTpqA+vSHK7rdnQVa1V -E8ubJNA1/k94gLd2x9l4iP9ofgeF7U+Z0/UV3sJ6/U9RDHvm5QYEbgnoufCNiI/F -59wUKSJbyCCVCH4t6w1PQg33hOHG+pqGDZS2L4Ji26UJzMb7cdftnn5BDOm8+pWX -An50t/4X2yhYC9HyiCUFKsZdew0Sb0LTtqwySpagrjiW6KhxVqUoN1YwSBrcseXW -DFsqQSPOYVMD9b05f5sog7gczI+2nusrshBWQD8rU0NPbuUladEJGP8MTlb2F4W5 -MecDnTUgJqvlrVgNULWaxcxby2NGh8bzoDXfE/Eg+JTDenh2g54= -=Pnl6 ------END PGP SIGNATURE----- diff --git a/apache-tomcat-9.0.31-src.tar.gz b/apache-tomcat-9.0.31-src.tar.gz new file mode 100644 index 0000000..e0b4c81 --- /dev/null +++ b/apache-tomcat-9.0.31-src.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4de10d690d8494efc551cb5de2fd5cdec1cda7ef387e9bc2d07ba834b91df3bc +size 5812430 diff --git a/apache-tomcat-9.0.31-src.tar.gz.asc b/apache-tomcat-9.0.31-src.tar.gz.asc new file mode 100644 index 0000000..eedbb86 --- /dev/null +++ b/apache-tomcat-9.0.31-src.tar.gz.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIzBAABCAAdFiEEqcXfTSLpmZjZh1pREMAcWi9gWecFAl47GtQACgkQEMAcWi9g +Wef+Kw/7BpH09+833RrzoTqc46HkfM9/FEMJWMwcAFVhZMeRcafCL1aFSwUt75jB +Ua3fErCpJAdXjSoKvINFuPPkXmgTw0HHBSqE8WZKd8Ar+ZUMzhW/cuy+5HUa4J2f +bIsz+eoqm/SCYKC1724XwXqiD/aCTvI0dYBTq1i3um0C1ZH02EW9idxTNIbeaSa0 +zZ95CK42m1ofodwH+pdkSVSHJ838ei4L3/ggAd+T0Xg35MaZJc5wy/hE279uZDcV +WBjAxF/JF8IRl3+5rumf9/xFAumphOJyTZlr4Zhi0NdVmt6Ktz+0SNkobgVRMjcv +izm/vXxK/wkpVVPkCw+Kk9gvsZL13b9TPEf37uTtDaavN9o3ENSQxuhLOZsRooUx +ZpwQBXC+P6zXp8N+HopHPsQpVPpxMGr5Mo8lBYov6QgmYwmbvBmCfjQcvk7X5h8r +MnDkdaqcQ8l4bSiF8h4Sm1lM88DXE+LW8UAW7/ANLfW00ATLZldzdPohHBOSxp0b +/VCnhZHw7UNPHNAdWvNgkRY3nHUiuFkJTsqWO06l1ARCLfuRb5bv+MBcKMPGROpI +fMTgJYBkAOpPq4gZd65aV9BkAPmFd6LZCRfwLEK75NUfeQWCrwMq68OFv5DKEClK +TzPRafdII7oN9ODG6KZfcwoVb1wJclMvHiMMJ5JP02nnGFiEPMk= +=29Ie +-----END PGP SIGNATURE----- diff --git a/tomcat-9.0.30-java8compat.patch b/tomcat-9.0.31-java8compat.patch similarity index 79% rename from tomcat-9.0.30-java8compat.patch rename to tomcat-9.0.31-java8compat.patch index 82c627c..754571c 100644 --- a/tomcat-9.0.30-java8compat.patch +++ b/tomcat-9.0.31-java8compat.patch @@ -1,8 +1,6 @@ -Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/connector/InputBuffer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.java -@@ -389,10 +389,10 @@ public class InputBuffer extends Reader +--- apache-tomcat-9.0.31-src/java/org/apache/catalina/connector/InputBuffer.java 2020-02-05 20:42:16.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/catalina/connector/InputBuffer.java 2020-02-25 14:10:19.650974252 +0100 +@@ -389,10 +389,10 @@ } int n = Math.min(to.remaining(), bb.remaining()); int orgLimit = bb.limit(); @@ -16,7 +14,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.j return n; } -@@ -488,11 +488,11 @@ public class InputBuffer extends Reader +@@ -488,11 +488,11 @@ long nRead = 0; while (nRead < n) { if (cb.remaining() >= n) { @@ -30,7 +28,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.j int nb = realReadChars(); if (nb < 0) { break; -@@ -533,7 +533,7 @@ public class InputBuffer extends Reader +@@ -533,7 +533,7 @@ } else { if ((cb.capacity() > (2 * size)) && (cb.remaining()) < (cb.position())) { cb.compact(); @@ -39,7 +37,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.j } } readLimit = cb.position() + readAheadLimit + size; -@@ -554,7 +554,7 @@ public class InputBuffer extends Reader +@@ -554,7 +554,7 @@ markPos = -1; throw new IOException(); } else { @@ -48,7 +46,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.j } } else { clear(bb); -@@ -672,10 +672,10 @@ public class InputBuffer extends Reader +@@ -672,10 +672,10 @@ CharBuffer tmp = CharBuffer.allocate(newSize); int oldPosition = cb.position(); @@ -62,11 +60,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/InputBuffer.j cb = tmp; tmp = null; } -Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/connector/OutputBuffer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer.java -@@ -761,10 +761,10 @@ public class OutputBuffer extends Writer +--- apache-tomcat-9.0.31-src/java/org/apache/catalina/connector/OutputBuffer.java 2020-02-05 20:42:16.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/catalina/connector/OutputBuffer.java 2020-02-25 14:10:19.662974317 +0100 +@@ -761,10 +761,10 @@ int limit = bb.capacity(); int fromLimit = from.limit(); while (from.remaining() >= limit) { @@ -80,10 +76,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/connector/OutputBuffer. } if (from.remaining() > 0) { -Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java +--- apache-tomcat-9.0.31-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 2020-02-05 20:42:27.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/catalina/tribes/transport/nio/NioReplicationTask.java 2020-02-25 14:10:19.662974317 +0100 @@ -18,6 +18,7 @@ package org.apache.catalina.tribes.transport.nio; import java.io.IOException; @@ -92,7 +86,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni import java.nio.ByteBuffer; import java.nio.channels.CancelledKeyException; import java.nio.channels.DatagramChannel; -@@ -80,7 +81,7 @@ public class NioReplicationTask extends +@@ -80,7 +81,7 @@ buffer = ByteBuffer.allocate(size); } } else { @@ -101,7 +95,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni } if (key == null) { return; // just in case -@@ -156,30 +157,30 @@ public class NioReplicationTask extends +@@ -156,30 +157,30 @@ reader.access(); ReadableByteChannel channel = (ReadableByteChannel) key.channel(); int count=-1; @@ -137,11 +131,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni //did we get a package count = reader.hasPackage()?1:-1; } -Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/catalina/tribes/transport/nio/NioSender.java -+++ apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java -@@ -20,6 +20,7 @@ package org.apache.catalina.tribes.trans +--- apache-tomcat-9.0.31-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java 2020-02-05 20:42:27.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/catalina/tribes/transport/nio/NioSender.java 2020-02-25 14:10:19.662974317 +0100 +@@ -20,6 +20,7 @@ import java.io.EOFException; import java.io.IOException; import java.net.InetSocketAddress; @@ -149,7 +141,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; -@@ -173,9 +174,9 @@ public class NioSender extends AbstractS +@@ -173,9 +174,9 @@ if ( read == -1 ) throw new IOException(sm.getString("nioSender.unable.receive.ack")); //no data read else if ( read == 0 ) return false; @@ -161,7 +153,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni if (ackbuf.doesPackageExist() ) { byte[] ackcmd = ackbuf.extractDataPackage(true).getBytes(); boolean ack = Arrays.equals(ackcmd,org.apache.catalina.tribes.transport.Constants.ACK_DATA); -@@ -225,12 +226,12 @@ public class NioSender extends AbstractS +@@ -225,12 +226,12 @@ if ( readbuf == null ) { readbuf = getReadBuffer(); } else { @@ -176,7 +168,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni } if (isUdpBased()) { -@@ -317,8 +318,8 @@ public class NioSender extends AbstractS +@@ -317,8 +318,8 @@ if ( isConnected() && readbuf == null) { readbuf = getReadBuffer(); } @@ -187,7 +179,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni current = null; ackbuf.clear(); remaining = 0; -@@ -357,7 +358,7 @@ public class NioSender extends AbstractS +@@ -357,7 +358,7 @@ remaining = length; ackbuf.clear(); if (writebuf != null) { @@ -196,7 +188,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni } else { writebuf = getBuffer(length); } -@@ -367,7 +368,7 @@ public class NioSender extends AbstractS +@@ -367,7 +368,7 @@ // TODO use ByteBuffer.wrap to avoid copying the data. writebuf.put(data,offset,length); @@ -205,11 +197,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/catalina/tribes/transport/nio/Ni if (isConnected()) { if (isUdpBased()) dataChannel.register(getSelector(), SelectionKey.OP_WRITE, this); -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/ajp/AjpProcessor.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java -@@ -21,6 +21,7 @@ import java.io.EOFException; +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/ajp/AjpProcessor.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/ajp/AjpProcessor.java 2020-02-25 14:10:19.662974317 +0100 +@@ -21,6 +21,7 @@ import java.io.IOException; import java.io.InterruptedIOException; import java.net.InetAddress; @@ -217,7 +207,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java import java.nio.ByteBuffer; import java.security.NoSuchProviderException; import java.security.cert.CertificateFactory; -@@ -1206,7 +1207,7 @@ public class AjpProcessor extends Abstra +@@ -1240,7 +1241,7 @@ responseMessage.reset(); responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); @@ -226,10 +216,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/ajp/AjpProcessor.java responseMessage.appendBytes(chunk); responseMessage.end(); socketWrapper.write(blocking, responseMessage.getBuffer(), 0, responseMessage.getLen()); -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/BufferedInputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/BufferedInputFilter.java 2020-02-25 14:10:19.662974317 +0100 @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -238,7 +226,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedIn import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -68,7 +69,7 @@ public class BufferedInputFilter impleme +@@ -68,7 +69,7 @@ public void setLimit(int limit) { if (buffered == null) { buffered = ByteBuffer.allocate(limit); @@ -247,7 +235,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedIn } } -@@ -84,9 +85,9 @@ public class BufferedInputFilter impleme +@@ -84,9 +85,9 @@ // save off the Request body try { while (buffer.doRead(this) >= 0) { @@ -259,7 +247,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedIn tempRead = null; } } catch(IOException | BufferOverflowException ioe) { -@@ -121,7 +122,7 @@ public class BufferedInputFilter impleme +@@ -121,7 +122,7 @@ if (buffered.capacity() > 65536) { buffered = null; } else { @@ -268,11 +256,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/BufferedIn } } hasRead = false; -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java -@@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 2020-02-25 14:10:19.662974317 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -280,7 +266,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Locale; -@@ -184,14 +185,14 @@ public class ChunkedInputFilter implemen +@@ -184,14 +185,14 @@ if (readChunk != handler.getByteBuffer()) { handler.setByteBuffer(readChunk.duplicate()); } @@ -297,7 +283,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp remaining = 0; //we need a CRLF if ((readChunk.position() + 1) >= readChunk.limit()) { -@@ -263,7 +264,7 @@ public class ChunkedInputFilter implemen +@@ -263,7 +264,7 @@ public void recycle() { remaining = 0; if (readChunk != null) { @@ -306,7 +292,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp } endChunk = false; needCRLFParse = false; -@@ -363,7 +364,7 @@ public class ChunkedInputFilter implemen +@@ -363,7 +364,7 @@ // Parsing the CRLF increments pos if (!eol) { @@ -315,7 +301,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp } } -@@ -415,7 +416,7 @@ public class ChunkedInputFilter implemen +@@ -415,7 +416,7 @@ throwIOException(sm.getString("chunkedInputFilter.invalidCrlf")); } @@ -324,7 +310,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp } } -@@ -484,7 +485,7 @@ public class ChunkedInputFilter implemen +@@ -484,7 +485,7 @@ trailingHeaders.append(chr); } @@ -333,7 +319,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp } int colonPos = trailingHeaders.getEnd(); -@@ -513,7 +514,7 @@ public class ChunkedInputFilter implemen +@@ -513,7 +514,7 @@ chr = readChunk.get(readChunk.position()); if ((chr == Constants.SP) || (chr == Constants.HT)) { @@ -342,7 +328,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp // If we swallow whitespace, make sure it counts towards the // limit placed on trailing header size int newlimit = trailingHeaders.getLimit() -1; -@@ -549,7 +550,7 @@ public class ChunkedInputFilter implemen +@@ -549,7 +550,7 @@ } if (!eol) { @@ -351,11 +337,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedInp } } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java -@@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java 2020-02-25 14:10:19.662974317 +0100 +@@ -18,6 +18,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; @@ -363,7 +347,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOut import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.HashSet; -@@ -106,12 +107,12 @@ public class ChunkedOutputFilter impleme +@@ -106,12 +107,12 @@ int pos = calculateChunkHeader(result); @@ -378,7 +362,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOut buffer.doWrite(chunkHeader); return result; -@@ -171,10 +172,10 @@ public class ChunkedOutputFilter impleme +@@ -171,10 +172,10 @@ if (trailerFields == null) { // Write end chunk buffer.doWrite(endChunk); @@ -391,7 +375,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOut ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.ISO_8859_1); -@@ -194,7 +195,7 @@ public class ChunkedOutputFilter impleme +@@ -194,7 +195,7 @@ buffer.doWrite(ByteBuffer.wrap(baos.toByteArray())); buffer.doWrite(crlfChunk); @@ -400,10 +384,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/ChunkedOut } buffer.end(); } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/IdentityInputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java 2020-02-25 14:10:19.662974317 +0100 @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -412,7 +394,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityIn import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -104,7 +105,7 @@ public class IdentityInputFilter impleme +@@ -104,7 +105,7 @@ // The chunk is longer than the number of bytes remaining // in the body; changing the chunk length to the number // of bytes remaining @@ -421,7 +403,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityIn result = (int) remaining; } else { result = nRead; -@@ -116,7 +117,7 @@ public class IdentityInputFilter impleme +@@ -116,7 +117,7 @@ // No more bytes left to be read : return -1 and clear the // buffer if (handler.getByteBuffer() != null) { @@ -430,10 +412,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityIn } result = -1; } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/IdentityOutputFilter.java 2020-02-25 14:10:19.662974317 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http11.filters; @@ -442,7 +422,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOu import java.nio.ByteBuffer; import org.apache.coyote.Response; -@@ -64,7 +65,7 @@ public class IdentityOutputFilter implem +@@ -64,7 +65,7 @@ // The chunk is longer than the number of bytes remaining // in the body; changing the chunk length to the number // of bytes remaining @@ -451,7 +431,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOu result = (int) remaining; remaining = 0; } else { -@@ -74,8 +75,8 @@ public class IdentityOutputFilter implem +@@ -74,8 +75,8 @@ } else { // No more bytes left to be written : return -1 and clear the // buffer @@ -462,10 +442,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/IdentityOu result = -1; } } else { -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java 2020-02-25 14:10:19.666974339 +0100 @@ -18,6 +18,7 @@ package org.apache.coyote.http11.filters; @@ -474,7 +452,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedReque import java.nio.ByteBuffer; import org.apache.coyote.InputBuffer; -@@ -51,7 +52,7 @@ public class SavedRequestInputFilter imp +@@ -51,7 +52,7 @@ return -1; ByteBuffer byteBuffer = handler.getByteBuffer(); @@ -483,11 +461,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/filters/SavedReque input.subtract(byteBuffer); return byteBuffer.remaining(); -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/Http11InputBuffer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer.java -@@ -18,6 +18,7 @@ package org.apache.coyote.http11; +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/Http11InputBuffer.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/Http11InputBuffer.java 2020-02-25 14:17:38.009341456 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -495,7 +471,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; -@@ -262,7 +263,7 @@ public class Http11InputBuffer implement +@@ -263,7 +264,7 @@ activeFilters[i].recycle(); } @@ -504,7 +480,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. lastActiveFilter = -1; parsingHeader = true; swallowInput = true; -@@ -290,10 +291,10 @@ public class Http11InputBuffer implement +@@ -291,10 +292,10 @@ if (byteBuffer.remaining() > 0) { // Copy leftover bytes to the beginning of the buffer byteBuffer.compact(); @@ -517,7 +493,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. } } -@@ -379,7 +380,7 @@ public class Http11InputBuffer implement +@@ -380,7 +381,7 @@ } chr = byteBuffer.get(); } while ((chr == Constants.CR) || (chr == Constants.LF)); @@ -526,7 +502,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. parsingRequestLineStart = byteBuffer.position(); parsingRequestLinePhase = 2; -@@ -409,7 +410,7 @@ public class Http11InputBuffer implement +@@ -410,7 +411,7 @@ request.method().setBytes(byteBuffer.array(), parsingRequestLineStart, pos - parsingRequestLineStart); } else if (!HttpParser.isToken(chr)) { @@ -535,7 +511,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. // Avoid unknown protocol triggering an additional error request.protocol().setString(Constants.HTTP_11); throw new IllegalArgumentException(sm.getString("iib.invalidmethod")); -@@ -429,7 +430,7 @@ public class Http11InputBuffer implement +@@ -430,7 +431,7 @@ byte chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { space = false; @@ -544,7 +520,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. } } parsingRequestLineStart = byteBuffer.position(); -@@ -498,7 +499,7 @@ public class Http11InputBuffer implement +@@ -499,7 +500,7 @@ byte chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { space = false; @@ -553,7 +529,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. } } parsingRequestLineStart = byteBuffer.position(); -@@ -598,7 +599,7 @@ public class Http11InputBuffer implement +@@ -599,7 +600,7 @@ if (swallowInput && (lastActiveFilter != -1)) { int extraBytes = (int) activeFilters[lastActiveFilter].end(); @@ -562,7 +538,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. } } -@@ -696,7 +697,7 @@ public class Http11InputBuffer implement +@@ -697,7 +698,7 @@ wrapper.getSocketBufferHandler().getReadBuffer().capacity(); if (byteBuffer == null || byteBuffer.capacity() < bufLength) { byteBuffer = ByteBuffer.allocate(bufLength); @@ -571,7 +547,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. } } -@@ -721,14 +722,14 @@ public class Http11InputBuffer implement +@@ -722,14 +723,14 @@ throw new IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error")); } } else { @@ -590,7 +566,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. SocketWrapperBase socketWrapper = this.wrapper; int nRead = -1; if (socketWrapper != null) { -@@ -736,7 +737,7 @@ public class Http11InputBuffer implement +@@ -737,7 +738,7 @@ } else { throw new CloseNowException(sm.getString("iib.eof.error")); } @@ -599,16 +575,20 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. if (nRead > 0) { return true; } else if (nRead == -1) { -@@ -778,7 +779,7 @@ public class Http11InputBuffer implement - } else if (chr == Constants.LF) { - return HeaderParseStatus.DONE; +@@ -784,10 +785,10 @@ } else { -- byteBuffer.position(byteBuffer.position() - 1); -+ ((Buffer)byteBuffer).position(byteBuffer.position() - 1); + if (prevChr == 0) { + // Must have only read one byte +- byteBuffer.position(byteBuffer.position() - 1); ++ ((Buffer)byteBuffer).position(byteBuffer.position() - 1); + } else { + // Must have read two bytes (first was CR, second was not LF) +- byteBuffer.position(byteBuffer.position() - 2); ++ ((Buffer)byteBuffer).position(byteBuffer.position() - 2); + } break; } - -@@ -820,7 +821,7 @@ public class Http11InputBuffer implement +@@ -830,7 +831,7 @@ // Non-token characters are illegal in header names // Parsing continues so the error can be reported in context headerData.lastSignificantChar = pos; @@ -617,7 +597,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. // skipLine() will handle the error return skipLine(); } -@@ -858,7 +859,7 @@ public class Http11InputBuffer implement +@@ -868,7 +869,7 @@ chr = byteBuffer.get(); if (!(chr == Constants.SP || chr == Constants.HT)) { headerParsePos = HeaderParsePosition.HEADER_VALUE; @@ -626,7 +606,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. break; } } -@@ -1073,7 +1074,7 @@ public class Http11InputBuffer implement +@@ -1102,7 +1103,7 @@ int length = byteBuffer.remaining(); handler.setByteBuffer(byteBuffer.duplicate()); @@ -635,7 +615,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. return length; } -@@ -1095,12 +1096,12 @@ public class Http11InputBuffer implement +@@ -1124,12 +1125,12 @@ @Override public void expand(int size) { if (byteBuffer.capacity() >= size) { @@ -650,10 +630,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11InputBuffer. temp = null; } } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http11/Http11OutputBuffer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/Http11OutputBuffer.java 2020-02-05 20:42:31.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http11/Http11OutputBuffer.java 2020-02-25 14:10:19.666974339 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http11; @@ -662,7 +640,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer import java.nio.ByteBuffer; import java.util.Arrays; -@@ -242,7 +243,7 @@ public class Http11OutputBuffer implemen +@@ -242,7 +243,7 @@ * headers so the error response can be written. */ void resetHeaderBuffer() { @@ -671,7 +649,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer } -@@ -270,7 +271,7 @@ public class Http11OutputBuffer implemen +@@ -270,7 +271,7 @@ // Recycle response object response.recycle(); // Reset pointers @@ -680,7 +658,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer lastActiveFilter = -1; responseFinished = false; byteCount = 0; -@@ -302,7 +303,7 @@ public class Http11OutputBuffer implemen +@@ -302,7 +303,7 @@ if (headerBuffer.position() > 0) { // Sending the response header buffer @@ -689,7 +667,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer try { SocketWrapperBase socketWrapper = this.socketWrapper; if (socketWrapper != null) { -@@ -311,7 +312,7 @@ public class Http11OutputBuffer implemen +@@ -311,7 +312,7 @@ throw new CloseNowException(sm.getString("iob.failedwrite")); } } finally { @@ -698,10 +676,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http11/Http11OutputBuffer } } } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/HpackDecoder.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/HpackDecoder.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/HpackDecoder.java 2020-02-25 14:10:19.666974339 +0100 @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -710,7 +686,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java import java.nio.ByteBuffer; import org.apache.tomcat.util.res.StringManager; -@@ -99,10 +100,10 @@ public class HpackDecoder { +@@ -99,10 +100,10 @@ byte b = buffer.get(); if ((b & 0b10000000) != 0) { //if the first bit is set it is an indexed header field @@ -723,7 +699,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java return; } else if(index == 0) { throw new HpackException( -@@ -113,12 +114,12 @@ public class HpackDecoder { +@@ -113,12 +114,12 @@ //Literal Header Field with Incremental Indexing String headerName = readHeaderName(buffer, 6); if (headerName == null) { @@ -738,7 +714,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java return; } emitHeader(headerName, headerValue); -@@ -127,12 +128,12 @@ public class HpackDecoder { +@@ -127,12 +128,12 @@ //Literal Header Field without Indexing String headerName = readHeaderName(buffer, 4); if (headerName == null) { @@ -753,7 +729,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java return; } emitHeader(headerName, headerValue); -@@ -140,12 +141,12 @@ public class HpackDecoder { +@@ -140,12 +141,12 @@ //Literal Header Field never indexed String headerName = readHeaderName(buffer, 4); if (headerName == null) { @@ -768,7 +744,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java return; } emitHeader(headerName, headerValue); -@@ -164,10 +165,10 @@ public class HpackDecoder { +@@ -164,10 +165,10 @@ if (headerCount != 0) { throw new HpackException(sm.getString("hpackdecoder.tableSizeUpdateNotAtStart")); } @@ -781,7 +757,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java return false; } if (size > maxMemorySizeHard) { -@@ -197,7 +198,7 @@ public class HpackDecoder { +@@ -197,7 +198,7 @@ } private String readHeaderName(ByteBuffer buffer, int prefixLength) throws HpackException { @@ -790,10 +766,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HpackDecoder.java int index = Hpack.decodeInteger(buffer, prefixLength); if (index == -1) { return null; -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/HPackHuffman.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/HPackHuffman.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/HPackHuffman.java 2020-02-25 14:10:19.666974339 +0100 @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -802,7 +776,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java import java.nio.ByteBuffer; import java.util.Arrays; import java.util.HashSet; -@@ -483,7 +484,7 @@ public class HPackHuffman { +@@ -483,7 +484,7 @@ int rem = code.length; while (rem > 0) { if (!buffer.hasRemaining()) { @@ -811,7 +785,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java return false; } int remainingInByte = 8 - bytePos; -@@ -504,7 +505,7 @@ public class HPackHuffman { +@@ -504,7 +505,7 @@ } if (bytePos == 8) { if (!buffer.hasRemaining()) { @@ -820,7 +794,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java return false; } buffer.put(currentBufferByte); -@@ -514,14 +515,14 @@ public class HPackHuffman { +@@ -514,14 +515,14 @@ if (buffer.position() - start > toEncode.length()) { //the encoded version is longer than the original //just return false @@ -837,10 +811,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/HPackHuffman.java return false; } buffer.put((byte) (currentBufferByte | ((0xFF) >> bytePos))); -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Hpack.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Hpack.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Hpack.java 2020-02-25 14:10:19.666974339 +0100 @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -849,7 +821,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java import java.nio.ByteBuffer; import org.apache.tomcat.util.res.StringManager; -@@ -165,7 +166,7 @@ final class Hpack { +@@ -165,7 +166,7 @@ if (source.remaining() == 0) { //we have run out of data //reset @@ -858,10 +830,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Hpack.java return -1; } b = source.get(); -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2AsyncParser.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2AsyncParser.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2AsyncParser.java 2020-02-25 14:10:19.666974339 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -870,7 +840,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.ja import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.util.concurrent.TimeUnit; -@@ -103,7 +104,7 @@ class Http2AsyncParser extends Http2Pars +@@ -103,7 +104,7 @@ public void completed(Long result, Void attachment) { if (streamException || error == null) { ByteBuffer payload = buffers[2]; @@ -879,7 +849,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.ja try { if (streamException) { swallow(streamId, payloadSize, false, payload); -@@ -232,7 +233,7 @@ class Http2AsyncParser extends Http2Pars +@@ -232,7 +233,7 @@ public void completed(Long result, Void attachment) { if (streamException || error == null) { ByteBuffer payload = buffers[1]; @@ -888,7 +858,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.ja try { boolean continueParsing; do { -@@ -286,7 +287,7 @@ class Http2AsyncParser extends Http2Pars +@@ -286,7 +287,7 @@ if (payload.remaining() - 9 >= payloadSize) { continueParsing = true; // Now go over frame header @@ -897,10 +867,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncParser.ja try { validateFrame(null, frameType, streamId, flags, payloadSize); } catch (StreamException e) { -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 2020-02-25 14:10:19.666974339 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -909,7 +877,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHa import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.channels.FileChannel; -@@ -216,11 +217,11 @@ public class Http2AsyncUpgradeHandler ex +@@ -216,11 +217,11 @@ if (writeable) { ByteUtil.set31Bits(header, 5, stream.getIdAsInt()); int orgLimit = data.limit(); @@ -923,10 +891,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2AsyncUpgradeHa handleAsyncException(); } } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2Parser.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2Parser.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2Parser.java 2020-02-25 14:10:19.666974339 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -935,7 +901,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -192,9 +193,9 @@ class Http2Parser { +@@ -192,9 +193,9 @@ input.fill(true, dest, dataLength); } else { int oldLimit = buffer.limit(); @@ -947,7 +913,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java } // Process padding before sending any notifications in case // padding is invalid. -@@ -475,12 +476,12 @@ class Http2Parser { +@@ -475,12 +476,12 @@ input.fill(true, headerReadBuffer, toRead); } else { int oldLimit = buffer.limit(); @@ -963,7 +929,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java try { hpackDecoder.decode(headerReadBuffer); } catch (HpackException hpe) { -@@ -550,7 +551,7 @@ class Http2Parser { +@@ -550,7 +551,7 @@ return; } if (!mustBeZero && byteBuffer != null) { @@ -972,7 +938,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java } else { int read = 0; byte[] buffer = new byte[1024]; -@@ -710,7 +711,7 @@ class Http2Parser { +@@ -710,7 +711,7 @@ default boolean fill(boolean block, ByteBuffer data, int len) throws IOException { boolean result = fill(block, data.array(), data.arrayOffset() + data.position(), len); if (result) { @@ -981,11 +947,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2Parser.java } return result; } -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Http2UpgradeHandler.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java -@@ -18,6 +18,7 @@ package org.apache.coyote.http2; +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Http2UpgradeHandler.java 2020-02-25 14:10:19.670974359 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -993,7 +957,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.HashSet; -@@ -762,9 +763,9 @@ class Http2UpgradeHandler extends Abstra +@@ -762,9 +763,9 @@ try { socketWrapper.write(true, header, 0, header.length); int orgLimit = data.limit(); @@ -1005,7 +969,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler socketWrapper.flush(true); } catch (IOException ioe) { handleAppInitiatedIOException(ioe); -@@ -1830,7 +1831,7 @@ class Http2UpgradeHandler extends Abstra +@@ -1830,7 +1831,7 @@ } catch (IOException ioe) { handleAppInitiatedIOException(ioe); } @@ -1014,10 +978,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Http2UpgradeHandler } @Override -Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/coyote/http2/Stream.java -+++ apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java +--- apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Stream.java 2020-02-05 20:42:32.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/coyote/http2/Stream.java 2020-02-25 14:10:19.670974359 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -1026,7 +988,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.AccessController; -@@ -850,9 +851,9 @@ class Stream extends AbstractStream impl +@@ -850,9 +851,9 @@ int chunkLimit = chunk.limit(); while (chunk.remaining() > 0) { int thisTime = Math.min(buffer.remaining(), chunk.remaining()); @@ -1038,7 +1000,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java if (chunk.remaining() > 0 && !buffer.hasRemaining()) { // Only flush if we have more data to write and the buffer // is full -@@ -922,7 +923,7 @@ class Stream extends AbstractStream impl +@@ -922,7 +923,7 @@ // Buffer is empty. Nothing to do. return false; } @@ -1047,7 +1009,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java int left = buffer.remaining(); while (left > 0) { if (streamReservation == 0) { -@@ -953,7 +954,7 @@ class Stream extends AbstractStream impl +@@ -953,7 +954,7 @@ left -= connectionReservation; } } @@ -1056,7 +1018,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java return false; } -@@ -1014,9 +1015,9 @@ class Stream extends AbstractStream impl +@@ -1014,9 +1015,9 @@ int chunkLimit = src.limit(); while (src.remaining() > 0) { int thisTime = Math.min(buffer.remaining(), src.remaining()); @@ -1068,7 +1030,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java if (flush(false, blocking)) { return true; } -@@ -1104,14 +1105,14 @@ class Stream extends AbstractStream impl +@@ -1104,14 +1105,14 @@ if (inBuffer.position() > 0) { // Data is available in the inBuffer. Copy it to the // outBuffer. @@ -1085,11 +1047,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/coyote/http2/Stream.java } else if (!canRead) { return -1; } else { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/B2CConverter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.util.buf; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/B2CConverter.java 2020-02-05 20:42:40.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/B2CConverter.java 2020-02-25 14:10:19.670974359 +0100 +@@ -18,6 +18,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -1097,7 +1057,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -107,7 +108,7 @@ public class B2CConverter { +@@ -107,7 +108,7 @@ */ public void recycle() { decoder.reset(); @@ -1106,7 +1066,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } /** -@@ -126,8 +127,8 @@ public class B2CConverter { +@@ -126,8 +127,8 @@ bb = ByteBuffer.wrap(bc.getBuffer(), bc.getStart(), bc.getLength()); } else { // Initialize the byte buffer @@ -1117,7 +1077,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } if ((cb == null) || (cb.array() != cc.getBuffer())) { // Create a new char buffer if anything changed -@@ -135,8 +136,8 @@ public class B2CConverter { +@@ -135,8 +136,8 @@ cc.getBuffer().length - cc.getEnd()); } else { // Initialize the char buffer @@ -1128,7 +1088,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } CoderResult result = null; // Parse leftover if any are present -@@ -145,16 +146,16 @@ public class B2CConverter { +@@ -145,16 +146,16 @@ // Loop until one char is decoded or there is a decoder error do { leftovers.put(bc.subtractB()); @@ -1150,7 +1110,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -172,8 +173,8 @@ public class B2CConverter { +@@ -172,8 +173,8 @@ cc.setEnd(cb.position()); // Put leftovers in the leftovers byte buffer if (bc.getLength() > 0) { @@ -1161,7 +1121,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav bc.subtract(leftovers.array(), 0, bc.getLength()); } } -@@ -196,16 +197,16 @@ public class B2CConverter { +@@ -196,16 +197,16 @@ bb = ByteBuffer.wrap(bc.array(), bc.arrayOffset() + bc.position(), bc.remaining()); } else { // Initialize the byte buffer @@ -1182,7 +1142,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } CoderResult result = null; // Parse leftover if any are present -@@ -221,16 +222,16 @@ public class B2CConverter { +@@ -221,16 +222,16 @@ chr = bc.get(); } leftovers.put(chr); @@ -1204,7 +1164,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -240,16 +241,16 @@ public class B2CConverter { +@@ -240,16 +241,16 @@ } else if (result.isOverflow()) { // Propagate current positions to the byte chunk and char chunk, if // this continues the char buffer will get resized @@ -1227,10 +1187,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/B2CConverter.jav bc.get(leftovers.array(), 0, bc.remaining()); } } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteBufferHolder.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java 2020-02-05 20:42:40.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteBufferHolder.java 2020-02-25 14:10:19.670974359 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1239,7 +1197,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; -@@ -46,7 +47,7 @@ public class ByteBufferHolder { +@@ -46,7 +47,7 @@ public boolean flip() { if (flipped.compareAndSet(false, true)) { @@ -1248,11 +1206,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferHolder return true; } else { return false; -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteBufferUtils.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java -@@ -19,6 +19,7 @@ package org.apache.tomcat.util.buf; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java 2020-02-05 20:42:40.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteBufferUtils.java 2020-02-25 14:10:19.670974359 +0100 +@@ -19,6 +19,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -1260,7 +1216,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils. import java.nio.ByteBuffer; import org.apache.juli.logging.Log; -@@ -108,7 +109,7 @@ public class ByteBufferUtils { +@@ -108,7 +109,7 @@ } // Copy data @@ -1269,11 +1225,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteBufferUtils. out.put(in); if (direct) { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/ByteChunk.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java -@@ -19,6 +19,7 @@ package org.apache.tomcat.util.buf; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteChunk.java 2020-02-05 20:42:40.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/ByteChunk.java 2020-02-25 14:10:19.670974359 +0100 +@@ -19,6 +19,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -1281,7 +1235,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -345,7 +346,7 @@ public final class ByteChunk extends Abs +@@ -345,7 +346,7 @@ // and avoid an extra copy if (len == limit && end == start && out != null) { out.realWriteBytes(from); @@ -1290,7 +1244,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java return; } // if we have limit and we're below -@@ -375,13 +376,13 @@ public final class ByteChunk extends Abs +@@ -375,13 +376,13 @@ int remain = len - avail; avail = limit - end; while (remain >= avail) { @@ -1307,7 +1261,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java from.get(buff, end, remain); end += remain; } -@@ -482,8 +483,8 @@ public final class ByteChunk extends Abs +@@ -482,8 +483,8 @@ } int n = Math.min(to.remaining(), getLength()); to.put(buff, start, n); @@ -1318,10 +1272,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/ByteChunk.java start += n; return n; } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/C2BConverter.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/C2BConverter.java 2020-02-05 20:42:41.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/C2BConverter.java 2020-02-25 14:10:19.670974359 +0100 @@ -17,6 +17,7 @@ package org.apache.tomcat.util.buf; @@ -1330,7 +1282,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; -@@ -51,7 +52,7 @@ public final class C2BConverter { +@@ -51,7 +52,7 @@ */ public void recycle() { encoder.reset(); @@ -1339,7 +1291,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav } public boolean isUndeflow() { -@@ -71,16 +72,16 @@ public final class C2BConverter { +@@ -71,16 +72,16 @@ bb = ByteBuffer.wrap(bc.getBuffer(), bc.getEnd(), bc.getBuffer().length - bc.getEnd()); } else { // Initialize the byte buffer @@ -1360,7 +1312,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav } CoderResult result = null; // Parse leftover if any are present -@@ -89,16 +90,16 @@ public final class C2BConverter { +@@ -89,16 +90,16 @@ // Loop until one char is encoded or there is a encoder error do { leftovers.put((char) cc.subtract()); @@ -1382,7 +1334,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -115,8 +116,8 @@ public final class C2BConverter { +@@ -115,8 +116,8 @@ cc.setOffset(cb.position()); // Put leftovers in the leftovers char buffer if (cc.getLength() > 0) { @@ -1393,7 +1345,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav cc.subtract(leftovers.array(), 0, cc.getLength()); } } -@@ -135,16 +136,16 @@ public final class C2BConverter { +@@ -135,16 +136,16 @@ bb = ByteBuffer.wrap(bc.array(), bc.limit(), bc.capacity() - bc.limit()); } else { // Initialize the byte buffer @@ -1414,7 +1366,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav } CoderResult result = null; // Parse leftover if any are present -@@ -153,16 +154,16 @@ public final class C2BConverter { +@@ -153,16 +154,16 @@ // Loop until one char is encoded or there is a encoder error do { leftovers.put(cc.get()); @@ -1436,7 +1388,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav } // Do the decoding and get the results into the byte chunk and the char // chunk -@@ -171,16 +172,16 @@ public final class C2BConverter { +@@ -171,16 +172,16 @@ result.throwException(); } else if (result.isOverflow()) { // Propagate current positions to the byte chunk and char chunk @@ -1459,10 +1411,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/C2BConverter.jav cc.get(leftovers.array(), 0, cc.remaining()); } } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/Utf8Decoder.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java 2020-02-05 20:42:41.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java 2020-02-25 14:10:19.670974359 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1471,7 +1421,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -140,7 +141,7 @@ public class Utf8Decoder extends Charset +@@ -140,7 +141,7 @@ } return CoderResult.UNDERFLOW; } finally { @@ -1480,7 +1430,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java } } -@@ -163,8 +164,8 @@ public class Utf8Decoder extends Charset +@@ -163,8 +164,8 @@ // If first byte is invalid, tail will be set to -1 int tail = remainingBytes[jchar]; if (tail == -1) { @@ -1491,7 +1441,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return CoderResult.malformedForLength(1); } // Additional checks to detect invalid sequences ASAP -@@ -175,72 +176,72 @@ public class Utf8Decoder extends Charset +@@ -175,72 +176,72 @@ // First byte C2..DF, second byte 80..BF if (jchar > 0x41 && jchar < 0x60 && (bArr[inIndex + 1] & 0xC0) != 0x80) { @@ -1584,7 +1534,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return CoderResult.malformedForLength(3); } } -@@ -250,8 +251,8 @@ public class Utf8Decoder extends Charset +@@ -250,8 +251,8 @@ for (int i = 0; i < tail; i++) { int nextByte = bArr[inIndex + i + 1] & 0xFF; if ((nextByte & 0xC0) != 0x80) { @@ -1595,7 +1545,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return CoderResult.malformedForLength(1 + i); } jchar = (jchar << 6) + nextByte; -@@ -259,8 +260,8 @@ public class Utf8Decoder extends Charset +@@ -259,8 +260,8 @@ jchar -= remainingNumbers[tail]; if (jchar < lowerEncodingLimit[tail]) { // Should have been encoded in fewer octets @@ -1606,7 +1556,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return CoderResult.malformedForLength(1); } inIndex += tail; -@@ -281,8 +282,8 @@ public class Utf8Decoder extends Charset +@@ -281,8 +282,8 @@ // Encoded with 4 bytes. inIndex currently points // to the final byte. Move it back to first byte. inIndex -= 3; @@ -1617,7 +1567,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return CoderResult.OVERFLOW; } cArr[outIndex++] = (char) ((jchar >> 0xA) + 0xD7C0); -@@ -290,8 +291,8 @@ public class Utf8Decoder extends Charset +@@ -290,8 +291,8 @@ outRemaining -= 2; } } @@ -1628,10 +1578,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Decoder.java return (outRemaining == 0 && inIndex < inIndexLimit) ? CoderResult.OVERFLOW : CoderResult.UNDERFLOW; -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/buf/Utf8Encoder.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java 2020-02-05 20:42:41.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java 2020-02-25 14:10:19.670974359 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -1640,7 +1588,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetEncoder; -@@ -56,8 +57,8 @@ public class Utf8Encoder extends Charset +@@ -56,8 +57,8 @@ if (jchar <= 0x7F) { if (outRemaining < 1) { @@ -1651,7 +1599,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (jchar & 0xFF); -@@ -65,8 +66,8 @@ public class Utf8Encoder extends Charset +@@ -65,8 +66,8 @@ } else if (jchar <= 0x7FF) { if (outRemaining < 2) { @@ -1662,7 +1610,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (0xC0 + ((jchar >> 6) & 0x1F)); -@@ -77,21 +78,21 @@ public class Utf8Encoder extends Charset +@@ -77,21 +78,21 @@ // in has to have one byte more. if (limit <= x + 1) { @@ -1690,7 +1638,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java return CoderResult.malformedForLength(1); } -@@ -99,8 +100,8 @@ public class Utf8Encoder extends Charset +@@ -99,8 +100,8 @@ // The surrogate pair ends with a high-surrogate. if (jchar2 < 0xDC00) { @@ -1701,7 +1649,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java return CoderResult.malformedForLength(1); } -@@ -121,8 +122,8 @@ public class Utf8Encoder extends Charset +@@ -121,8 +122,8 @@ } else { if (outRemaining < 3) { @@ -1712,7 +1660,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java return CoderResult.OVERFLOW; } bArr[outPos++] = (byte) (0xE0 + ((jchar >> 12) & 0x0F)); -@@ -131,8 +132,8 @@ public class Utf8Encoder extends Charset +@@ -131,8 +132,8 @@ outRemaining -= 3; } if (outRemaining == 0) { @@ -1723,7 +1671,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java // If both input and output are exhausted, return UNDERFLOW if (x + 1 == limit) { return CoderResult.UNDERFLOW; -@@ -143,8 +144,8 @@ public class Utf8Encoder extends Charset +@@ -143,8 +144,8 @@ } if (rem != 0) { @@ -1734,7 +1682,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java } return CoderResult.UNDERFLOW; } -@@ -228,7 +229,7 @@ public class Utf8Encoder extends Charset +@@ -228,7 +229,7 @@ pos++; } } finally { @@ -1743,11 +1691,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/buf/Utf8Encoder.java } return CoderResult.UNDERFLOW; } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/AprEndpoint.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java -@@ -20,6 +20,7 @@ import java.io.EOFException; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/AprEndpoint.java 2020-02-05 20:42:45.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/AprEndpoint.java 2020-02-25 14:10:19.674974381 +0100 +@@ -20,6 +20,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketTimeoutException; @@ -1755,7 +1701,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.charset.StandardCharsets; -@@ -2040,7 +2041,7 @@ public class AprEndpoint extends Abstrac +@@ -2040,7 +2041,7 @@ // SSL and app buffer size settings with NIO & NIO2. if (endpoint.isSSLEnabled()) { sslOutputBuffer = ByteBuffer.allocateDirect(SSL_OUTPUT_BUFFER_SIZE); @@ -1764,7 +1710,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java } else { sslOutputBuffer = null; } -@@ -2102,7 +2103,7 @@ public class AprEndpoint extends Abstrac +@@ -2102,7 +2103,7 @@ // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (to.isDirect() && to.remaining() >= limit) { @@ -1773,7 +1719,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); -@@ -2181,7 +2182,7 @@ public class AprEndpoint extends Abstrac +@@ -2181,7 +2182,7 @@ } if (result > 0) { @@ -1782,7 +1728,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java return result; } else if (result == 0 || -result == Status.EAGAIN) { return 0; -@@ -2305,9 +2306,9 @@ public class AprEndpoint extends Abstrac +@@ -2303,9 +2304,9 @@ if (getEndpoint().isSSLEnabled()) { if (sslOutputBuffer.remaining() == 0) { // Buffer was fully written last time around @@ -1794,7 +1740,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java } else { // Buffer still has data from previous attempt to write // APR + SSL requires that exactly the same parameters are -@@ -2316,13 +2317,13 @@ public class AprEndpoint extends Abstrac +@@ -2314,13 +2315,13 @@ thisTime = Socket.sendb(getSocket().longValue(), sslOutputBuffer, sslOutputBuffer.position(), sslOutputBuffer.limit()); if (thisTime > 0) { @@ -1810,11 +1756,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/AprEndpoint.java } } if (Status.APR_STATUS_IS_EAGAIN(-thisTime)) { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/Nio2Endpoint.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java -@@ -22,6 +22,7 @@ import java.io.IOException; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java 2020-02-05 20:42:45.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/Nio2Endpoint.java 2020-02-25 14:10:19.674974381 +0100 +@@ -22,6 +22,7 @@ import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.SocketTimeoutException; @@ -1822,7 +1766,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.jav import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousCloseException; -@@ -541,7 +542,7 @@ public class Nio2Endpoint extends Abstra +@@ -541,7 +542,7 @@ if (nRead > 0) { getSocket().getBufHandler().configureWriteBufferForRead(); if (attachment.length < buffer.remaining()) { @@ -1831,7 +1775,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.jav } attachment.length -= nRead; } else { -@@ -895,7 +896,7 @@ public class Nio2Endpoint extends Abstra +@@ -895,7 +896,7 @@ // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (block && to.remaining() >= limit) { @@ -1840,11 +1784,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/Nio2Endpoint.jav nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/NioEndpoint.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java -@@ -23,6 +23,7 @@ import java.io.IOException; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/NioEndpoint.java 2020-02-05 20:42:45.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/NioEndpoint.java 2020-02-25 14:10:19.674974381 +0100 +@@ -23,6 +23,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketTimeoutException; @@ -1852,7 +1794,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java import java.nio.ByteBuffer; import java.nio.channels.CancelledKeyException; import java.nio.channels.Channel; -@@ -1139,7 +1140,7 @@ public class NioEndpoint extends Abstrac +@@ -1154,7 +1155,7 @@ // The socket read buffer capacity is socket.appReadBufSize int limit = socketBufferHandler.getReadBuffer().capacity(); if (to.remaining() >= limit) { @@ -1861,10 +1803,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/NioEndpoint.java nRead = fillReadBuffer(block, to); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], Read direct from socket: [" + nRead + "]"); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 2020-02-25 14:10:19.674974381 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.net.openssl; @@ -1873,7 +1813,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE import java.nio.ByteBuffer; import java.nio.ReadOnlyBufferException; import java.security.Principal; -@@ -40,7 +41,7 @@ import javax.net.ssl.SSLSessionContext; +@@ -40,7 +41,7 @@ import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -1882,7 +1822,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE import org.apache.tomcat.jni.Pool; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.jni.SSLContext; -@@ -130,7 +131,7 @@ public final class OpenSSLEngine extends +@@ -130,7 +131,7 @@ private static final String INVALID_CIPHER = "SSL_NULL_WITH_NULL_NULL"; @@ -1891,7 +1831,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE // OpenSSL state private long ssl; -@@ -242,10 +243,10 @@ public final class OpenSSLEngine extends +@@ -242,10 +243,10 @@ final int sslWrote; if (src.isDirect()) { @@ -1904,7 +1844,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return sslWrote; } } else { -@@ -253,17 +254,17 @@ public final class OpenSSLEngine extends +@@ -253,17 +254,17 @@ try { final long addr = memoryAddress(buf); @@ -1926,7 +1866,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE } } finally { buf.clear(); -@@ -282,10 +283,10 @@ public final class OpenSSLEngine extends +@@ -282,10 +283,10 @@ final int pos = src.position(); final int len = src.remaining(); if (src.isDirect()) { @@ -1939,7 +1879,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return netWrote; } } else { -@@ -297,10 +298,10 @@ public final class OpenSSLEngine extends +@@ -297,10 +298,10 @@ final int netWrote = SSL.writeToBIO(networkBIO, addr, len); if (netWrote >= 0) { @@ -1952,7 +1892,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE } } finally { buf.clear(); -@@ -317,11 +318,11 @@ public final class OpenSSLEngine extends +@@ -317,11 +318,11 @@ private static int readPlaintextData(final long ssl, final ByteBuffer dst) { if (dst.isDirect()) { final int pos = dst.position(); @@ -1966,7 +1906,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return sslRead; } } else { -@@ -335,9 +336,9 @@ public final class OpenSSLEngine extends +@@ -335,9 +336,9 @@ final int sslRead = SSL.readFromSSL(ssl, addr, len); if (sslRead > 0) { buf.limit(sslRead); @@ -1978,7 +1918,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return sslRead; } } finally { -@@ -355,10 +356,10 @@ public final class OpenSSLEngine extends +@@ -355,10 +356,10 @@ private static int readEncryptedData(final long networkBIO, final ByteBuffer dst, final int pending) { if (dst.isDirect() && dst.remaining() >= pending) { final int pos = dst.position(); @@ -1991,7 +1931,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return bioRead; } } else { -@@ -370,9 +371,9 @@ public final class OpenSSLEngine extends +@@ -370,9 +371,9 @@ if (bioRead > 0) { buf.limit(bioRead); int oldLimit = dst.limit(); @@ -2003,7 +1943,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE return bioRead; } } finally { -@@ -963,7 +964,7 @@ public final class OpenSSLEngine extends +@@ -963,7 +964,7 @@ private static long memoryAddress(ByteBuffer buf) { @@ -2012,11 +1952,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/openssl/OpenSSLE } private SSLEngineResult.Status getEngineStatus() { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SecureNio2Channel.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.util.net; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SecureNio2Channel.java 2020-02-25 14:10:19.674974381 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -2024,7 +1962,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; -@@ -133,7 +134,7 @@ public class SecureNio2Channel extends N +@@ -133,7 +134,7 @@ unwrapBeforeRead = true; closed = false; closing = false; @@ -2033,7 +1971,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe } @Override -@@ -323,7 +324,7 @@ public class SecureNio2Channel extends N +@@ -323,7 +324,7 @@ } else if (handshake.getStatus() == Status.BUFFER_UNDERFLOW) { if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data @@ -2042,7 +1980,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe } //read more data if (async) { -@@ -418,9 +419,9 @@ public class SecureNio2Channel extends N +@@ -418,9 +419,9 @@ clientRequestedCiphers = Collections.emptyList(); break; case NON_SECURE: @@ -2054,7 +1992,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe flush(); throw new IOException(sm.getString("channel.nio.ssl.foundHttp")); } -@@ -444,8 +445,8 @@ public class SecureNio2Channel extends N +@@ -444,8 +445,8 @@ netOutBuffer = ByteBufferUtils.expand(netOutBuffer, sslEngine.getSession().getPacketBufferSize()); // Set limit and position to expected values @@ -2065,7 +2003,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe // Initiate handshake sslEngine.beginHandshake(); -@@ -469,10 +470,10 @@ public class SecureNio2Channel extends N +@@ -469,10 +470,10 @@ if (!getBufHandler().isReadBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appInputNotEmpty")); if (!getBufHandler().isWriteBufferEmpty()) throw new IOException(sm.getString("channel.nio.ssl.appOutputNotEmpty")); @@ -2080,7 +2018,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe getBufHandler().reset(); handshakeComplete = false; -@@ -521,12 +522,12 @@ public class SecureNio2Channel extends N +@@ -521,12 +522,12 @@ protected SSLEngineResult handshakeWrap() throws IOException { //this should never be called with a network buffer that contains data //so we can clear it here. @@ -2095,7 +2033,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //set the status handshakeStatus = result.getHandshakeStatus(); return result; -@@ -543,7 +544,7 @@ public class SecureNio2Channel extends N +@@ -543,7 +544,7 @@ //loop while we can perform pure SSLEngine data do { //prepare the buffer with the incoming data @@ -2104,7 +2042,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //call unwrap getBufHandler().configureReadBufferForWrite(); result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer()); -@@ -601,7 +602,7 @@ public class SecureNio2Channel extends N +@@ -601,7 +602,7 @@ throw new IOException(sm.getString("channel.nio.ssl.pendingWriteDuringClose"), e); } //prep the buffer for the close message @@ -2113,7 +2051,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //perform the close, since we called sslEngine.closeOutbound SSLEngineResult handshake = sslEngine.wrap(getEmptyBuf(), netOutBuffer); //we should be in a close state -@@ -609,7 +610,7 @@ public class SecureNio2Channel extends N +@@ -609,7 +610,7 @@ throw new IOException(sm.getString("channel.nio.ssl.invalidCloseState")); } //prepare the buffer for writing @@ -2122,7 +2060,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //if there is data to be written try { if (timeout > 0) { -@@ -711,7 +712,7 @@ public class SecureNio2Channel extends N +@@ -711,7 +712,7 @@ SSLEngineResult unwrap; do { //prepare the buffer @@ -2131,7 +2069,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //unwrap the data try { unwrap = sslEngine.unwrap(netInBuffer, dst); -@@ -854,10 +855,10 @@ public class SecureNio2Channel extends N +@@ -854,10 +855,10 @@ protected void wrap() { try { if (!netOutBuffer.hasRemaining()) { @@ -2144,7 +2082,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); -@@ -909,7 +910,7 @@ public class SecureNio2Channel extends N +@@ -909,7 +910,7 @@ SSLEngineResult unwrap; do { //prepare the buffer @@ -2153,7 +2091,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dst2); //compact the buffer -@@ -1019,7 +1020,7 @@ public class SecureNio2Channel extends N +@@ -1019,7 +1020,7 @@ } processOverflow = false; //prepare the buffer @@ -2162,7 +2100,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dsts2, offset, length2); //compact the buffer -@@ -1138,11 +1139,11 @@ public class SecureNio2Channel extends N +@@ -1138,11 +1139,11 @@ } try { // Prepare the output buffer @@ -2176,7 +2114,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); -@@ -1192,11 +1193,11 @@ public class SecureNio2Channel extends N +@@ -1192,11 +1193,11 @@ } try { // Prepare the output buffer @@ -2190,11 +2128,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNio2Channe if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { tasks(); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SecureNioChannel.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel.java -@@ -19,6 +19,7 @@ package org.apache.tomcat.util.net; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SecureNioChannel.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SecureNioChannel.java 2020-02-25 14:10:19.674974381 +0100 +@@ -19,6 +19,7 @@ import java.io.EOFException; import java.io.IOException; import java.net.SocketTimeoutException; @@ -2202,7 +2138,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; -@@ -95,7 +96,7 @@ public class SecureNioChannel extends Ni +@@ -95,7 +96,7 @@ handshakeComplete = false; closed = false; closing = false; @@ -2211,7 +2147,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel } @Override -@@ -315,9 +316,9 @@ public class SecureNioChannel extends Ni +@@ -315,9 +316,9 @@ clientRequestedCiphers = Collections.emptyList(); break; case NON_SECURE: @@ -2223,7 +2159,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel flushOutbound(); throw new IOException(sm.getString("channel.nio.ssl.foundHttp")); } -@@ -341,8 +342,8 @@ public class SecureNioChannel extends Ni +@@ -341,8 +342,8 @@ netOutBuffer = ByteBufferUtils.expand(netOutBuffer, sslEngine.getSession().getPacketBufferSize()); // Set limit and position to expected values @@ -2234,7 +2170,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel // Initiate handshake sslEngine.beginHandshake(); -@@ -454,12 +455,12 @@ public class SecureNioChannel extends Ni +@@ -454,12 +455,12 @@ protected SSLEngineResult handshakeWrap(boolean doWrite) throws IOException { //this should never be called with a network buffer that contains data //so we can clear it here. @@ -2249,7 +2185,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //set the status handshakeStatus = result.getHandshakeStatus(); //optimization, if we do have a writable channel, write it now -@@ -479,7 +480,7 @@ public class SecureNioChannel extends Ni +@@ -479,7 +480,7 @@ if (netInBuffer.position() == netInBuffer.limit()) { //clear the buffer if we have emptied it out on data @@ -2258,7 +2194,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel } if (doread) { //if we have data to read, read it -@@ -493,7 +494,7 @@ public class SecureNioChannel extends Ni +@@ -493,7 +494,7 @@ //loop while we can perform pure SSLEngine data do { //prepare the buffer with the incoming data @@ -2267,7 +2203,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //call unwrap getBufHandler().configureReadBufferForWrite(); result = sslEngine.unwrap(netInBuffer, getBufHandler().getReadBuffer()); -@@ -537,7 +538,7 @@ public class SecureNioChannel extends Ni +@@ -537,7 +538,7 @@ throw new IOException(sm.getString("channel.nio.ssl.remainingDataDuringClose")); } //prep the buffer for the close message @@ -2276,7 +2212,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //perform the close, since we called sslEngine.closeOutbound SSLEngineResult handshake = sslEngine.wrap(getEmptyBuf(), netOutBuffer); //we should be in a close state -@@ -545,7 +546,7 @@ public class SecureNioChannel extends Ni +@@ -545,7 +546,7 @@ throw new IOException(sm.getString("channel.nio.ssl.invalidCloseState")); } //prepare the buffer for writing @@ -2285,7 +2221,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //if there is data to be written flush(netOutBuffer); -@@ -612,7 +613,7 @@ public class SecureNioChannel extends Ni +@@ -612,7 +613,7 @@ SSLEngineResult unwrap; do { //prepare the buffer @@ -2294,7 +2230,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dst); //compact the buffer -@@ -691,7 +692,7 @@ public class SecureNioChannel extends Ni +@@ -691,7 +692,7 @@ } processOverflow = false; //prepare the buffer @@ -2303,7 +2239,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel //unwrap the data unwrap = sslEngine.unwrap(netInBuffer, dsts, offset, length); //compact the buffer -@@ -798,12 +799,12 @@ public class SecureNioChannel extends Ni +@@ -798,12 +799,12 @@ } // The data buffer is empty, we can reuse the entire buffer. @@ -2318,7 +2254,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { -@@ -835,12 +836,12 @@ public class SecureNioChannel extends Ni +@@ -835,12 +836,12 @@ } // The data buffer is empty, we can reuse the entire buffer. @@ -2333,10 +2269,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SecureNioChannel if (result.getStatus() == Status.OK) { if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SocketBufferHandler.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SocketBufferHandler.java 2020-02-25 14:10:19.678974403 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.net; @@ -2345,7 +2279,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHand import java.nio.ByteBuffer; import org.apache.tomcat.util.buf.ByteBufferUtils; -@@ -66,13 +67,13 @@ public class SocketBufferHandler { +@@ -66,13 +67,13 @@ // Switching to write int remaining = readBuffer.remaining(); if (remaining == 0) { @@ -2361,7 +2295,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHand } this.readBufferConfiguredForWrite = readBufferConFiguredForWrite; } -@@ -110,15 +111,15 @@ public class SocketBufferHandler { +@@ -110,15 +111,15 @@ // Switching to write int remaining = writeBuffer.remaining(); if (remaining == 0) { @@ -2381,7 +2315,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHand } this.writeBufferConfiguredForWrite = writeBufferConfiguredForWrite; } -@@ -149,9 +150,9 @@ public class SocketBufferHandler { +@@ -149,9 +150,9 @@ public void reset() { @@ -2393,11 +2327,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketBufferHand writeBufferConfiguredForWrite = true; } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/SocketWrapperBase.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java -@@ -19,6 +19,7 @@ package org.apache.tomcat.util.net; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java 2020-02-25 14:10:19.678974403 +0100 +@@ -19,6 +19,7 @@ import java.io.EOFException; import java.io.IOException; import java.net.SocketTimeoutException; @@ -2405,7 +2337,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBas import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.channels.InterruptedByTimeoutException; -@@ -1468,9 +1469,9 @@ public abstract class SocketWrapperBase< +@@ -1468,9 +1469,9 @@ int max = Math.min(from.remaining(), to.remaining()); if (max > 0) { int fromLimit = from.limit(); @@ -2417,10 +2349,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/SocketWrapperBas } return max; } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/TLSClientHelloExtractor.java 2020-02-25 14:10:19.678974403 +0100 @@ -17,6 +17,7 @@ package org.apache.tomcat.util.net; @@ -2429,7 +2359,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -@@ -76,7 +77,7 @@ public class TLSClientHelloExtractor { +@@ -76,7 +77,7 @@ String sniValue = null; try { // Switch to read mode. @@ -2438,7 +2368,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx // A complete TLS record header is required before we can figure out // how many bytes there are in the record. -@@ -164,8 +165,8 @@ public class TLSClientHelloExtractor { +@@ -164,8 +165,8 @@ this.clientRequestedApplicationProtocols = clientRequestedApplicationProtocols; this.sniValue = sniValue; // Whatever happens, return the buffer to its original state @@ -2449,7 +2379,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx } } -@@ -215,7 +216,7 @@ public class TLSClientHelloExtractor { +@@ -215,7 +216,7 @@ private static boolean isAvailable(ByteBuffer bb, int size) { if (bb.remaining() < size) { @@ -2458,7 +2388,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx return false; } return true; -@@ -243,7 +244,7 @@ public class TLSClientHelloExtractor { +@@ -243,7 +244,7 @@ // the buffer contains a correctly formatted HTTP request line. // The method, target and protocol are not validated. byte chr = 0; @@ -2467,7 +2397,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx // Skip blank lines do { -@@ -324,7 +325,7 @@ public class TLSClientHelloExtractor { +@@ -324,7 +325,7 @@ private static void skipBytes(ByteBuffer bb, int size) { @@ -2476,10 +2406,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/TLSClientHelloEx } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/util/net/WriteBuffer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/WriteBuffer.java 2020-02-05 20:42:46.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/util/net/WriteBuffer.java 2020-02-25 14:10:19.678974403 +0100 @@ -17,6 +17,7 @@ package org.apache.tomcat.util.net; @@ -2488,11 +2416,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/util/net/WriteBuffer.java import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Iterator; -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java 2020-02-05 20:42:47.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java 2020-02-25 14:10:19.678974403 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -2500,7 +2426,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; -@@ -189,7 +190,7 @@ public class AsyncChannelWrapperSecure i +@@ -189,7 +190,7 @@ for (int i = offset; i < offset + length; i++) { ByteBuffer src = srcs[i]; while (src.hasRemaining()) { @@ -2509,7 +2435,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra // Encrypt the data SSLEngineResult r = sslEngine.wrap(src, socketWriteBuffer); -@@ -215,7 +216,7 @@ public class AsyncChannelWrapperSecure i +@@ -215,7 +216,7 @@ } } @@ -2518,7 +2444,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra // Do the write int toWrite = r.bytesProduced(); -@@ -272,7 +273,7 @@ public class AsyncChannelWrapperSecure i +@@ -272,7 +273,7 @@ } } @@ -2527,7 +2453,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra if (socketReadBuffer.hasRemaining()) { // Decrypt the data in the buffer -@@ -358,7 +359,7 @@ public class AsyncChannelWrapperSecure i +@@ -358,7 +359,7 @@ try { sslEngine.beginHandshake(); // So the first compact does the right thing @@ -2536,7 +2462,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra handshakeStatus = sslEngine.getHandshakeStatus(); resultStatus = Status.OK; -@@ -368,11 +369,11 @@ public class AsyncChannelWrapperSecure i +@@ -368,11 +369,11 @@ while(handshaking) { switch (handshakeStatus) { case NEED_WRAP: { @@ -2550,7 +2476,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra Future fWrite = socketChannel.write(socketWriteBuffer); fWrite.get(); -@@ -386,7 +387,7 @@ public class AsyncChannelWrapperSecure i +@@ -386,7 +387,7 @@ socketChannel.read(socketReadBuffer); fRead.get(); } @@ -2559,10 +2485,8 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/AsyncChannelWra SSLEngineResult r = sslEngine.unwrap(socketReadBuffer, DUMMY); checkResult(r, false); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/PerMessageDeflate.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2020-02-25 14:10:19.678974403 +0100 @@ -17,6 +17,7 @@ package org.apache.tomcat.websocket; @@ -2571,7 +2495,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -207,11 +208,11 @@ public class PerMessageDeflate implement +@@ -207,11 +208,11 @@ } catch (NullPointerException e) { throw new IOException(sm.getString("perMessageDeflate.alreadyClosed"), e); } @@ -2585,7 +2509,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla TransformationResult nextResult = next.getMoreData(opCode, fin, (rsv ^ RSV_BITMASK), readBuffer); inflater.setInput( -@@ -355,7 +356,7 @@ public class PerMessageDeflate implement +@@ -355,7 +356,7 @@ int written = deflater.deflate(compressedPayload.array(), compressedPayload.arrayOffset() + compressedPayload.position(), compressedPayload.remaining(), flush); @@ -2594,7 +2518,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla } catch (NullPointerException e) { throw new IOException(sm.getString("perMessageDeflate.alreadyClosed"), e); } -@@ -375,7 +376,7 @@ public class PerMessageDeflate implement +@@ -375,7 +376,7 @@ writeBuffer = ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE); // Flip the compressed payload ready for writing @@ -2603,7 +2527,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla boolean fin = uncompressedPart.isFin(); boolean full = compressedPayload.limit() == compressedPayload.capacity(); -@@ -384,7 +385,7 @@ public class PerMessageDeflate implement +@@ -384,7 +385,7 @@ if (fin && !full && needsInput) { // End of compressed message. Drop EOM bytes and output. @@ -2612,7 +2536,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla compressedPart = new MessagePart(true, getRsv(uncompressedPart), opCode, compressedPayload, uncompressedIntermediateHandler, uncompressedIntermediateHandler, blockingWriteTimeoutExpiry); -@@ -419,7 +420,7 @@ public class PerMessageDeflate implement +@@ -419,7 +420,7 @@ } if (eomBufferWritten < EOM_BUFFER.length) { // EOM has just been completed @@ -2621,10 +2545,32 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/PerMessageDefla compressedPart = new MessagePart(true, getRsv(uncompressedPart), opCode, compressedPayload, uncompressedIntermediateHandler, uncompressedIntermediateHandler, -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsFrameBase.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.java +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java 2020-02-05 20:42:49.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java 2020-02-25 14:10:19.678974403 +0100 +@@ -19,6 +19,7 @@ + import java.io.EOFException; + import java.io.IOException; + import java.nio.ByteBuffer; ++import java.nio.Buffer; + + import org.apache.juli.logging.Log; + import org.apache.juli.logging.LogFactory; +@@ -67,10 +68,10 @@ + + while (isOpen() && !isSuspended()) { + // Fill up the input buffer with as much data as we can +- inputBuffer.mark(); +- inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); ++ ((Buffer)inputBuffer).mark(); ++ ((Buffer)inputBuffer).position(inputBuffer.limit()).limit(inputBuffer.capacity()); + int read = socketWrapper.read(false, inputBuffer); +- inputBuffer.limit(inputBuffer.position()).reset(); ++ ((Buffer)inputBuffer).limit(inputBuffer.position()).reset(); + if (read < 0) { + throw new EOFException(); + } else if (read == 0) { +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsFrameBase.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsFrameBase.java 2020-02-25 14:10:19.678974403 +0100 @@ -17,6 +17,7 @@ package org.apache.tomcat.websocket; @@ -2633,7 +2579,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -91,7 +92,7 @@ public abstract class WsFrameBase { +@@ -91,7 +92,7 @@ public WsFrameBase(WsSession wsSession, Transformation transformation) { inputBuffer = ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE); @@ -2642,7 +2588,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav messageBufferBinary = ByteBuffer.allocate(wsSession.getMaxBinaryMessageBufferSize()); messageBufferText = CharBuffer.allocate(wsSession.getMaxTextMessageBufferSize()); wsSession.setWsFrame(this); -@@ -257,11 +258,11 @@ public abstract class WsFrameBase { +@@ -257,11 +258,11 @@ if (payloadLength == 126) { payloadLength = byteArrayToLong(inputBuffer.array(), inputBuffer.arrayOffset() + inputBuffer.position(), 2); @@ -2656,7 +2602,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } if (Util.isControl(opCode)) { if (payloadLength > 125) { -@@ -313,13 +314,13 @@ public abstract class WsFrameBase { +@@ -313,13 +314,13 @@ // Control messages have fixed message size so // TransformationResult.OVERFLOW is not possible here @@ -2672,7 +2618,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav // Payload must be zero or 2+ bytes long throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, -@@ -331,8 +332,8 @@ public abstract class WsFrameBase { +@@ -331,8 +332,8 @@ CoderResult cr = utf8DecoderControl.decode(controlBufferBinary, controlBufferText, true); if (cr.isError()) { @@ -2683,7 +2629,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav throw new WsIOException(new CloseReason( CloseCodes.PROTOCOL_ERROR, sm.getString("wsFrame.invalidUtf8Close"))); -@@ -340,7 +341,7 @@ public abstract class WsFrameBase { +@@ -340,7 +341,7 @@ // There will be no overflow as the output buffer is big // enough. There will be no underflow as all the data is // passed to the decoder in a single call. @@ -2692,7 +2638,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav reason = controlBufferText.toString(); } } -@@ -357,17 +358,17 @@ public abstract class WsFrameBase { +@@ -357,17 +358,17 @@ } catch (Throwable t) { handleThrowableOnSend(t); } finally { @@ -2713,7 +2659,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav newFrame(); return true; } -@@ -397,7 +398,7 @@ public abstract class WsFrameBase { +@@ -397,7 +398,7 @@ } catch (Throwable t) { handleThrowableOnSend(t); } finally { @@ -2722,7 +2668,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } } -@@ -408,7 +409,7 @@ public abstract class WsFrameBase { +@@ -408,7 +409,7 @@ while (!TransformationResult.END_OF_FRAME.equals(tr)) { // Frame not complete - we ran out of something // Convert bytes to UTF-8 @@ -2731,7 +2677,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav while (true) { CoderResult cr = utf8DecoderMessage.decode(messageBufferBinary, messageBufferText, false); -@@ -419,9 +420,9 @@ public abstract class WsFrameBase { +@@ -419,9 +420,9 @@ } else if (cr.isOverflow()) { // Ran out of space in text buffer - flush it if (usePartial()) { @@ -2743,7 +2689,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } else { throw new WsIOException(new CloseReason( CloseCodes.TOO_BIG, -@@ -448,7 +449,7 @@ public abstract class WsFrameBase { +@@ -448,7 +449,7 @@ tr = transformation.getMoreData(opCode, fin, rsv, messageBufferBinary); } @@ -2752,7 +2698,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav boolean last = false; // Frame is fully received // Convert bytes to UTF-8 -@@ -462,9 +463,9 @@ public abstract class WsFrameBase { +@@ -462,9 +463,9 @@ } else if (cr.isOverflow()) { // Ran out of space in text buffer - flush it if (usePartial()) { @@ -2764,7 +2710,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } else { throw new WsIOException(new CloseReason( CloseCodes.TOO_BIG, -@@ -477,9 +478,9 @@ public abstract class WsFrameBase { +@@ -477,9 +478,9 @@ // If partial messages are supported, send what we have // managed to decode if (usePartial()) { @@ -2776,7 +2722,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } messageBufferBinary.compact(); newFrame(); -@@ -491,7 +492,7 @@ public abstract class WsFrameBase { +@@ -491,7 +492,7 @@ } } else { // End of message @@ -2785,7 +2731,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav sendMessageText(true); newMessage(); -@@ -519,12 +520,12 @@ public abstract class WsFrameBase { +@@ -519,12 +520,12 @@ Long.valueOf(payloadLength))); throw new WsIOException(cr); } @@ -2801,7 +2747,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav // Read more data tr = transformation.getMoreData(opCode, fin, rsv, messageBufferBinary); } -@@ -534,12 +535,12 @@ public abstract class WsFrameBase { +@@ -534,12 +535,12 @@ // - partial messages are supported // - the message is complete if (usePartial() || !continuationExpected) { @@ -2817,7 +2763,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } if (continuationExpected) { -@@ -588,8 +589,8 @@ public abstract class WsFrameBase { +@@ -588,8 +589,8 @@ private void newMessage() { @@ -2828,7 +2774,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav utf8DecoderMessage.reset(); continuationExpected = false; newFrame(); -@@ -598,7 +599,7 @@ public abstract class WsFrameBase { +@@ -598,7 +599,7 @@ private void newFrame() { if (inputBuffer.remaining() == 0) { @@ -2837,7 +2783,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } maskIndex = 0; -@@ -631,7 +632,7 @@ public abstract class WsFrameBase { +@@ -631,7 +632,7 @@ private void makeRoom() { inputBuffer.compact(); @@ -2846,7 +2792,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav } -@@ -649,7 +650,7 @@ public abstract class WsFrameBase { +@@ -649,7 +650,7 @@ private boolean swallowInput() { long toSkip = Math.min(payloadLength - payloadWritten, inputBuffer.remaining()); @@ -2855,7 +2801,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav payloadWritten += toSkip; if (payloadWritten == payloadLength) { if (continuationExpected) { -@@ -945,9 +946,9 @@ public abstract class WsFrameBase { +@@ -945,9 +946,9 @@ toWrite = Math.min(toWrite, dest.remaining()); int orgLimit = inputBuffer.limit(); @@ -2867,11 +2813,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameBase.jav payloadWritten += toWrite; if (payloadWritten == payloadLength) { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsFrameClient.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsFrameClient.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsFrameClient.java 2020-02-25 14:10:19.678974403 +0100 +@@ -18,6 +18,7 @@ import java.io.EOFException; import java.io.IOException; @@ -2879,7 +2823,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.j import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; -@@ -76,8 +77,8 @@ public class WsFrameClient extends WsFra +@@ -76,8 +77,8 @@ // and then a new socket read will be performed return; } @@ -2890,7 +2834,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.j int toCopy = Math.min(response.remaining(), inputBuffer.remaining()); -@@ -85,16 +86,16 @@ public class WsFrameClient extends WsFra +@@ -85,16 +86,16 @@ // frame processing int orgLimit = response.limit(); @@ -2911,7 +2855,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.j // Get some more data if (isOpen()) { -@@ -159,7 +160,7 @@ public class WsFrameClient extends WsFra +@@ -159,7 +160,7 @@ // No data to process return; } @@ -2920,7 +2864,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.j doResumeProcessing(true); } -@@ -169,7 +170,7 @@ public class WsFrameClient extends WsFra +@@ -169,7 +170,7 @@ // response will be empty if this exception is thrown response = ByteBuffer .allocate(((ReadBufferOverflowException) exc).getMinBufferSize()); @@ -2929,11 +2873,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsFrameClient.j doResumeProcessing(false); } else { close(exc); -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java -@@ -20,6 +20,7 @@ import java.io.IOException; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java 2020-02-25 14:10:19.678974403 +0100 +@@ -20,6 +20,7 @@ import java.io.OutputStream; import java.io.Writer; import java.net.SocketTimeoutException; @@ -2941,7 +2883,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetEncoder; -@@ -240,13 +241,13 @@ public abstract class WsRemoteEndpointIm +@@ -240,13 +241,13 @@ long timeoutExpiry = getTimeoutExpiry(); boolean isDone = false; while (!isDone) { @@ -2957,7 +2899,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin sendMessageBlock(Constants.OPCODE_TEXT, encoderBuffer, last && isDone, timeoutExpiry); } stateMachine.complete(last); -@@ -321,7 +322,7 @@ public abstract class WsRemoteEndpointIm +@@ -321,7 +322,7 @@ } if (payload != null) { @@ -2966,7 +2908,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin } endMessage(null, null); -@@ -433,7 +434,7 @@ public abstract class WsRemoteEndpointIm +@@ -433,7 +434,7 @@ if (Constants.INTERNAL_OPCODE_FLUSH == mp.getOpCode()) { nextFragmented = fragmented; nextText = text; @@ -2975,7 +2917,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin SendHandler flushHandler = new OutputBufferFlushSendHandler( outputBuffer, mp.getEndHandler()); doWrite(flushHandler, mp.getBlockingWriteTimeoutExpiry(), outputBuffer); -@@ -482,10 +483,10 @@ public abstract class WsRemoteEndpointIm +@@ -482,10 +483,10 @@ mask = null; } @@ -2988,7 +2930,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin if (getBatchingAllowed() || isMasked()) { // Need to write via output buffer -@@ -798,13 +799,13 @@ public abstract class WsRemoteEndpointIm +@@ -798,13 +799,13 @@ } public void write() { @@ -3004,7 +2946,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); } -@@ -865,7 +866,7 @@ public abstract class WsRemoteEndpointIm +@@ -865,7 +866,7 @@ } if (headerBuffer.hasRemaining()) { // Still more headers to write, need to flush @@ -3013,7 +2955,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin endpoint.doWrite(this, blockingWriteTimeoutExpiry, outputBuffer); return; } -@@ -879,7 +880,7 @@ public abstract class WsRemoteEndpointIm +@@ -879,7 +880,7 @@ if (payloadLeft > outputSpace) { toWrite = outputSpace; // Temporarily reduce the limit @@ -3022,7 +2964,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin } if (mask == null) { -@@ -897,15 +898,15 @@ public abstract class WsRemoteEndpointIm +@@ -897,15 +898,15 @@ if (payloadLeft > outputSpace) { // Restore the original limit @@ -3041,7 +2983,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin if (outputBuffer.remaining() == 0) { handler.onResult(SENDRESULT_OK); } else { -@@ -923,7 +924,7 @@ public abstract class WsRemoteEndpointIm +@@ -923,7 +924,7 @@ if (outputBuffer.hasRemaining()) { endpoint.doWrite(this, blockingWriteTimeoutExpiry, outputBuffer); } else { @@ -3050,7 +2992,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin write(); } } else { -@@ -949,7 +950,7 @@ public abstract class WsRemoteEndpointIm +@@ -949,7 +950,7 @@ @Override public void onResult(SendResult result) { if (result.isOK()) { @@ -3059,7 +3001,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin } handler.onResult(result); } -@@ -1042,11 +1043,11 @@ public abstract class WsRemoteEndpointIm +@@ -1042,11 +1043,11 @@ private void doWrite(boolean last) throws IOException { if (used) { @@ -3073,7 +3015,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin } } -@@ -1121,9 +1122,9 @@ public abstract class WsRemoteEndpointIm +@@ -1121,9 +1122,9 @@ private void doWrite(boolean last) throws IOException { if (used) { @@ -3085,11 +3027,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsRemoteEndpoin } else { endpoint.stateMachine.complete(last); } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsSession.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsSession.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsSession.java 2020-02-25 14:10:19.678974403 +0100 +@@ -18,6 +18,7 @@ import java.io.IOException; import java.net.URI; @@ -3097,7 +3037,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java import java.nio.ByteBuffer; import java.nio.channels.WritePendingException; import java.nio.charset.StandardCharsets; -@@ -607,7 +608,7 @@ public class WsSession implements Sessio +@@ -607,7 +608,7 @@ if (reason != null && reason.length() > 0) { appendCloseReasonWithTruncation(msg, reason); } @@ -3106,11 +3046,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsSession.java try { wsRemoteEndpoint.sendMessageBlock(Constants.OPCODE_CLOSE, msg, true); } catch (IOException | WritePendingException e) { -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/WsWebSocketContainer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java -@@ -27,6 +27,7 @@ import java.net.ProxySelector; +--- apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2020-02-05 20:42:48.000000000 +0100 ++++ apache-tomcat-9.0.31-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2020-02-25 14:10:19.678974403 +0100 +@@ -27,6 +27,7 @@ import java.net.SocketAddress; import java.net.URI; import java.net.URISyntaxException; @@ -3118,7 +3056,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketCont import java.nio.ByteBuffer; import java.nio.channels.AsynchronousChannelGroup; import java.nio.channels.AsynchronousSocketChannel; -@@ -742,7 +743,7 @@ public class WsWebSocketContainer implem +@@ -742,7 +743,7 @@ // Terminating CRLF result.put(CRLF); @@ -3127,7 +3065,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketCont return result; } -@@ -771,7 +772,7 @@ public class WsWebSocketContainer implem +@@ -771,7 +772,7 @@ newSize = input.capacity() * 2; } ByteBuffer expanded = ByteBuffer.allocate(newSize); @@ -3136,7 +3074,7 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketCont expanded.put(input); input = expanded; } -@@ -800,14 +801,14 @@ public class WsWebSocketContainer implem +@@ -800,14 +801,14 @@ while (!readHeaders) { // On entering loop buffer will be empty and at the start of a new // loop the buffer will have been fully read. @@ -3153,11 +3091,9 @@ Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/WsWebSocketCont while (response.hasRemaining() && !readHeaders) { if (line == null) { line = readLine(response); -Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java -@@ -25,6 +25,7 @@ import java.io.OutputStreamWriter; +--- apache-tomcat-9.0.31-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java 2020-02-05 20:42:57.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/coyote/http11/upgrade/TestUpgradeInternalHandler.java 2020-02-25 14:10:19.678974403 +0100 +@@ -25,6 +25,7 @@ import java.io.PrintWriter; import java.io.Writer; import java.net.Socket; @@ -3165,7 +3101,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgrad import java.nio.ByteBuffer; import java.nio.channels.CompletionHandler; import java.nio.charset.StandardCharsets; -@@ -215,7 +216,7 @@ public class TestUpgradeInternalHandler +@@ -215,7 +216,7 @@ } private void write(ByteBuffer buffer) { @@ -3174,11 +3110,9 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http11/upgrade/TestUpgrad CompletionState state = wrapper.write(BlockingMode.BLOCK, 10, TimeUnit.SECONDS, null, SocketWrapperBase.COMPLETE_WRITE, new CompletionHandler() { @Override public void completed(Long result, Void attachment) { -Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/Http2TestBase.java -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java -@@ -23,6 +23,7 @@ import java.io.InputStream; +--- apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/Http2TestBase.java 2020-02-05 20:42:57.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/Http2TestBase.java 2020-02-25 14:10:19.678974403 +0100 +@@ -23,6 +23,7 @@ import java.io.OutputStream; import java.net.Socket; import java.net.SocketException; @@ -3186,7 +3120,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -@@ -217,7 +218,7 @@ public abstract class Http2TestBase exte +@@ -217,7 +218,7 @@ if (padding != null) { headersPayload.put(padding); } @@ -3195,7 +3129,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -250,7 +251,7 @@ public abstract class Http2TestBase exte +@@ -250,7 +251,7 @@ } hpackEncoder.encode(mimeHeaders, headersPayload); @@ -3204,7 +3138,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -278,7 +279,7 @@ public abstract class Http2TestBase exte +@@ -278,7 +279,7 @@ } hpackEncoder.encode(mimeHeaders, headersPayload); @@ -3213,7 +3147,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java ByteUtil.setThreeBytes(frameHeader, 0, headersPayload.limit()); frameHeader[3] = FrameType.CONTINUATION.getIdByte(); -@@ -368,7 +369,7 @@ public abstract class Http2TestBase exte +@@ -368,7 +369,7 @@ } hpackEncoder.encode(headers, headersPayload); @@ -3222,7 +3156,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java ByteUtil.setThreeBytes(headersFrameHeader, 0, headersPayload.limit()); headersFrameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -380,18 +381,18 @@ public abstract class Http2TestBase exte +@@ -380,18 +381,18 @@ // Data if (padding != null) { dataPayload.put((byte) (padding.length & 0xFF)); @@ -3244,7 +3178,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java // Size ByteUtil.setThreeBytes(dataFrameHeader, 0, dataPayload.limit()); -@@ -413,7 +414,7 @@ public abstract class Http2TestBase exte +@@ -413,7 +414,7 @@ trailerHeaders.addValue(TRAILER_HEADER_NAME).setString(TRAILER_HEADER_VALUE); hpackEncoder.encode(trailerHeaders, trailersPayload); @@ -3253,7 +3187,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java ByteUtil.setThreeBytes(trailersFrameHeader, 0, trailersPayload.limit()); trailersFrameHeader[3] = FrameType.HEADERS.getIdByte(); -@@ -989,7 +990,7 @@ public abstract class Http2TestBase exte +@@ -989,7 +990,7 @@ if (bodyBuffer != null) { if (bodyBuffer.limit() > 0) { trace.append(lastStreamId + "-Body-"); @@ -3262,10 +3196,8 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/Http2TestBase.java while (bodyBuffer.hasRemaining()) { trace.append((char) bodyBuffer.get()); } -Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHpack.java -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java +--- apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHpack.java 2020-02-05 20:42:57.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHpack.java 2020-02-25 14:10:19.678974403 +0100 @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -3274,7 +3206,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java import java.nio.ByteBuffer; import org.junit.Assert; -@@ -34,13 +35,13 @@ public class TestHpack { +@@ -34,13 +35,13 @@ ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3291,7 +3223,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java // Size is now 3 after using the table Assert.assertEquals(3, output.remaining()); } -@@ -54,15 +55,15 @@ public class TestHpack { +@@ -54,15 +55,15 @@ ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3310,7 +3242,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java headers2.recycle(); Assert.assertEquals(3, output.remaining()); // Check that the decoder is using the table right -@@ -120,7 +121,7 @@ public class TestHpack { +@@ -120,7 +121,7 @@ // by another byte output.array()[7] = (byte) -122; output.put((byte) -1); @@ -3319,7 +3251,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java MimeHeaders headers2 = new MimeHeaders(); HpackDecoder decoder = new HpackDecoder(); decoder.setHeaderEmitter(new HeadersListener(headers2)); -@@ -136,7 +137,7 @@ public class TestHpack { +@@ -136,7 +137,7 @@ ByteBuffer output = ByteBuffer.allocate(512); HpackEncoder encoder = new HpackEncoder(); encoder.encode(headers, output); @@ -3328,10 +3260,8 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHpack.java MimeHeaders headers2 = new MimeHeaders(); HpackDecoder decoder = new HpackDecoder(); decoder.setHeaderEmitter(new HeadersListener(headers2)); -Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHttp2Limits.java -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.java +--- apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHttp2Limits.java 2020-02-05 20:42:57.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHttp2Limits.java 2020-02-25 14:10:19.678974403 +0100 @@ -17,6 +17,7 @@ package org.apache.coyote.http2; @@ -3340,7 +3270,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.jav import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -290,7 +291,7 @@ public class TestHttp2Limits extends Htt +@@ -290,7 +291,7 @@ if (state != State.COMPLETE) { throw new Exception("Unable to build headers"); } @@ -3349,10 +3279,8 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Limits.jav log.debug("Headers payload generated of size [" + headersPayload.limit() + "]"); } -Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/coyote/http2/TestHttp2Section_8_1.java -+++ apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java +--- apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java 2020-02-05 20:42:58.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/coyote/http2/TestHttp2Section_8_1.java 2020-02-25 14:10:19.678974403 +0100 @@ -16,6 +16,7 @@ */ package org.apache.coyote.http2; @@ -3361,7 +3289,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; -@@ -186,7 +187,7 @@ public class TestHttp2Section_8_1 extend +@@ -186,7 +187,7 @@ headers.clear(); headers.add(new Header(":authority", "localhost:" + getPort())); @@ -3370,10 +3298,8 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/coyote/http2/TestHttp2Section_8_ buildSimpleGetRequestPart2(headersFrameHeader, headersPayload, headers , 3); -Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/tomcat/util/buf/TestUtf8.java -+++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java +--- apache-tomcat-9.0.31-src/test/org/apache/tomcat/util/buf/TestUtf8.java 2020-02-05 20:43:00.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/tomcat/util/buf/TestUtf8.java 2020-02-25 14:10:19.678974403 +0100 @@ -16,6 +16,7 @@ */ package org.apache.tomcat.util.buf; @@ -3382,7 +3308,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharsetDecoder; -@@ -579,7 +580,7 @@ public class TestUtf8 { +@@ -579,7 +580,7 @@ // an invalid sequence has been provided for (int i = 0; i < len; i++) { bb.put((byte) testCase.input[i]); @@ -3391,7 +3317,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java CoderResult cr = decoder.decode(bb, cb, false); if (cr.isError()) { int expected = testCase.invalidIndex; -@@ -604,11 +605,11 @@ public class TestUtf8 { +@@ -604,11 +605,11 @@ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); // Add each byte one at a time. @@ -3406,7 +3332,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java CoderResult cr = decoder.decode(bb, cb, false); if (cr.isError()) { Assert.fail(testCase.description); -@@ -617,12 +618,12 @@ public class TestUtf8 { +@@ -617,12 +618,12 @@ } // For incomplete sequences at the end of the input need to tell // the decoder the input has ended @@ -3421,11 +3347,9 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/util/buf/TestUtf8.java String expected = testCase.outputReplaced; if ((flags & REPLACE_SWALLOWS_TRAILER) != 0) { -Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java -+++ apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java -@@ -18,6 +18,7 @@ package org.apache.tomcat.websocket.pojo +--- apache-tomcat-9.0.31-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 2020-02-05 20:43:02.000000000 +0100 ++++ apache-tomcat-9.0.31-src/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 2020-02-25 14:10:19.678974403 +0100 +@@ -18,6 +18,7 @@ import java.io.IOException; import java.net.URI; @@ -3433,7 +3357,7 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodi import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; -@@ -604,7 +605,7 @@ public class TestEncodingDecoding extend +@@ -604,7 +605,7 @@ reply.put((byte) 0x12); reply.put((byte) 0x34); reply.put(data); @@ -3442,29 +3366,3 @@ Index: apache-tomcat-9.0.30-src/test/org/apache/tomcat/websocket/pojo/TestEncodi return reply; } } -Index: apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java -=================================================================== ---- apache-tomcat-9.0.30-src.orig/java/org/apache/tomcat/websocket/server/WsFrameServer.java -+++ apache-tomcat-9.0.30-src/java/org/apache/tomcat/websocket/server/WsFrameServer.java -@@ -19,6 +19,7 @@ package org.apache.tomcat.websocket.serv - import java.io.EOFException; - import java.io.IOException; - import java.nio.ByteBuffer; -+import java.nio.Buffer; - - import org.apache.juli.logging.Log; - import org.apache.juli.logging.LogFactory; -@@ -67,10 +68,10 @@ public class WsFrameServer extends WsFra - - while (isOpen() && !isSuspended()) { - // Fill up the input buffer with as much data as we can -- inputBuffer.mark(); -- inputBuffer.position(inputBuffer.limit()).limit(inputBuffer.capacity()); -+ ((Buffer)inputBuffer).mark(); -+ ((Buffer)inputBuffer).position(inputBuffer.limit()).limit(inputBuffer.capacity()); - int read = socketWrapper.read(false, inputBuffer); -- inputBuffer.limit(inputBuffer.position()).reset(); -+ ((Buffer)inputBuffer).limit(inputBuffer.position()).reset(); - if (read < 0) { - throw new EOFException(); - } else if (read == 0) { diff --git a/tomcat.changes b/tomcat.changes index fa58faf..88c1c3a 100644 --- a/tomcat.changes +++ b/tomcat.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Tue Feb 25 13:24:14 UTC 2020 - Fridrich Strba + +- Update to Tomcat 9.0.31. See changelog at + http://tomcat.apache.org/tomcat-9.0-doc/changelog.html#Tomcat_9.0.30_(markt) +- Fixed CVEs: + * CVE-2019-17569 (bsc#1164825) + * CVE-2020-1935 + * CVE-2020-1938 (bsc#1164692) +- Modified patch + * tomcat-9.0.30-java8compat.patch + -> tomcat-9.0.31-java8compat.patch + + Adapt to changed context + ------------------------------------------------------------------- Wed Jan 29 16:49:29 UTC 2020 - Matei Albu diff --git a/tomcat.spec b/tomcat.spec index d8a8e5c..3ba2e78 100644 --- a/tomcat.spec +++ b/tomcat.spec @@ -22,7 +22,7 @@ %define elspec 3.0 %define major_version 9 %define minor_version 0 -%define micro_version 30 +%define micro_version 31 %define packdname apache-tomcat-%{version}-src # FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ %global basedir /srv/%{name} @@ -80,7 +80,7 @@ Patch3: %{name}-%{major_version}.%{minor_version}-javadoc.patch # PATCH-FIX-OPENSUSE: include all necessary aqute-bnd jars Patch4: tomcat-9.0-osgi-build.patch # PATCH-FIX-OPENSUSE: cast ByteBuffer to Buffer in cases where there is a risk of using Java 9+ apis -Patch5: tomcat-9.0.30-java8compat.patch +Patch5: tomcat-9.0.31-java8compat.patch BuildRequires: ant >= 1.8.1 BuildRequires: ant-antlr