Fixes #6072 - jetty server high CPU when client send data length > 17408.

Updates after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2021-03-22 10:47:56 +01:00
parent be22761a20
commit 039c7386d0
1 changed files with 6 additions and 7 deletions

View File

@ -712,13 +712,15 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
return filled = -1;
case BUFFER_UNDERFLOW:
if (netFilled > 0)
if (BufferUtil.space(_encryptedInput) == 0)
{
if (BufferUtil.space(_encryptedInput) > 0)
continue; // try filling some more
BufferUtil.clear(_encryptedInput);
throw new SSLHandshakeException("Encrypted buffer max length exceeded");
}
if (netFilled > 0)
continue; // try filling some more
_underflown = true;
if (netFilled < 0 && _sslEngine.getUseClientMode())
{
@ -1423,9 +1425,7 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
return false;
if (isTLS13())
return false;
if (_sslEngine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING)
return false;
return true;
return _sslEngine.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING;
}
private boolean allowRenegotiate()
@ -1559,6 +1559,5 @@ public class SslConnection extends AbstractConnection implements Connection.Upgr
return String.format("SSL@%h.DEP.writeCallback", SslConnection.this);
}
}
}
}