-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #4217 - SslConnection.DecryptedEnpoint.flush eternal busy loop. #4218
Fixes #4217 - SslConnection.DecryptedEnpoint.flush eternal busy loop. #4218
Conversation
Releasing the encrypted output buffer so that it can be re-acquired with an expanded capacity. Signed-off-by: Simone Bordet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix looks OK to me, but do we have a possible similar problem in fill?
@gregw in Handling case BUFFER_OVERFLOW:
if (BufferUtil.isEmpty(_decryptedInput))
{
releaseDecryptedInputBuffer();
continue;
}
throw new IllegalStateException(); The idea is that we release the too small application buffer we decrypt into, and loop around to get a new The same problem may happen in The change to handle the |
I now think that we should only do the reallocate loop if we know the buffer size has changed. We should do for both fill and flush |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if the buffer capacity differs from the sllEngine size before reallocating and looping
Releasing the decrypted input buffer so that it can be re-acquired with an expanded capacity. Looping around only if the buffer size has changed. Signed-off-by: Simone Bordet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than a minor question
SSLSession hsSession = _sslEngine.getHandshakeSession(); | ||
SSLSession session = _sslEngine.getSession(); | ||
int size = session.getApplicationBufferSize(); | ||
if (hsSession == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it worthwhile doing
if (hsSession == null || hsSession == session)
or can they never be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, will add that.
Also would be good to have a test, even one that just sent a hand crafted 5 byte frame. |
@gregw will try to craft a test case... the test that I removed was failing because it was not causing the buffer expansion and now that |
Updates after review. Added test case. Signed-off-by: Simone Bordet <[email protected]>
@gregw updated and wrote a test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
#4217
Releasing the encrypted output buffer so that it can be re-acquired
with an expanded capacity.
Signed-off-by: Simone Bordet [email protected]