pombreda / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

Assertion/Crash when using SecureTunnelSessionClient and accepting an incoming Tunnel #135

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Register a signal handler for SecureTunnelSessionClient::SignalIncomingTunnel
2. In the handler call SecureTunnelSessionClient::AcceptTunnel(session)
3. Assertion in SecureTunnelSession::OnAccept (securetunnelsessionclient.cc 
line 368):   ASSERT(ssl_stream_reference_.get() != NULL);

What is the expected output? What do you see instead?
No assertion and a working secure tunnel should be returned.

What version of the product are you using? On what operating system?
libjingle 0.52

Please provide any additional information below.
OnAccept needs an Stream that is already wrapped in a SSLStreamAdapter. However 
the stream gets wrapped later on in SecureTunnelSession::GetStream so 
ssl_stream_reference_ is still NULL in OnAccept.

I did the following to fix this problem:
In tunnelsessionclient.cc line 173 you see that Accept is called before 
GetStream (and therefore before the Stream is wrapped by a SSLStreamAdapter). 
Changing the code like this solves the problem:

talk_base::StreamInterface* resStream = tunnel->GetStream();    // must be called 
prior to Accept in order install the SSLStreamAdapter
session->Accept(answer);
return resStream;

Original issue reported on code.google.com by mfle...@gmail.com on 4 Feb 2011 at 8:36

GoogleCodeExporter commented 9 years ago
This is only used in PCP, so set to low priority.

Original comment by jun...@google.com on 16 Nov 2011 at 11:05