-
Notifications
You must be signed in to change notification settings - Fork 872
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
Fixed crash in craftKmResponse due to CryptoControl being NULL #2277
Fixed crash in craftKmResponse due to CryptoControl being NULL #2277
Conversation
size_t exp_len = | ||
CHandShake::m_iContentSize; // When CHandShake::m_iContentSize is used in log, the file fails to link! | ||
// When CHandShake::m_iContentSize is used in log, the file fails to link! | ||
size_t exp_len = CHandShake::m_iContentSize; |
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 can be fixed easier - in 10772 use +CHandShake::m_iContentSize
instead of exp_len
.
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.
As I can see, you wrote that exactly this (using the CHandShake::m_iContentSize
in log) fails to link.
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.
You missed the +
before the name. This is exactly what fixes the problem.
@@ -3908,6 +3908,14 @@ EConnectStatus srt::CUDT::craftKmResponse(uint32_t* aw_kmdata, size_t& w_kmdatas | |||
int hs_flags = SrtHSRequest::SRT_HSTYPE_HSFLAGS::unwrap(m_ConnRes.m_iType); | |||
if (IsSet(hs_flags, CHandShake::HS_EXT_KMREQ)) | |||
{ | |||
if (!m_pCryptoControl) |
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 lacks an explanation as to why this fixes the problem. This function should at best have:
- The declarations of all mutexes that are locked before calling this function and made sure that the list is stable against all places from which this function is called
- In all places that can modify
m_pCryptoControl
make sure that locking on that place can exclude the possibility of modifying this field anywhere up to the end of this function (mention these places here)
Update listener write-ready only after the new connection. Was changed in Haivision#1650, but must not be done at all (see Haivision#1831).
ea289a4
to
ceeeca5
Compare
CryptoControl
exists incraftKmResponse(..)
. Fixes [BUG] Crash in srt::CUDT::craftKmResponse from a null pointer in m_pCryptoControl #2231.CUDT::processConnectRequest(..)
function.