[Vortex] PATCH: Fix crash when channel-open is refused

Jens Alfke jens at mooseyard.com
Wed Apr 9 01:09:14 CEST 2008


Just hit a reproducible crash opening a channel, when the remote peer  
refuses. It's in __vortex_channel_new, and it looks like there's a  
missing test for NULL on the 'channel' variable, at line 3342:
		if (channel->is_opened && vortex_channel_have_piggyback (channel)) {
The lines just before do test for NULL, but this line crashes.

Here's the last logging output, and a couple of gdb commands:

CRITICAL: Vortex+vortex-channel: received a negative reply to the  
start channel num=3, profile=http://mooseyard.com/cloudy/uri/gossip
CRITICAL: Vortex+vortex-channel: channel=3 creation have failed
CRITICAL: Vortex+: Expresion 'channel' have failed, returning: false  
at vortex_channel_ref (/Hack/Others/Vortex/vortex/src/MacOSX/../../src/ 
vortex_channel.c:3342)
Program received signal:  “EXC_BAD_ACCESS”.
(gdb) bt
#0  0x0025c497 in __vortex_channel_new (data=0xe0a7a00) at /Hack/ 
Others/Vortex/vortex/src/MacOSX/../../src/vortex_channel.c:895
#1  0x0027d4bb in __vortex_thread_pool_dispatcher (data=0x9d8380) at / 
Hack/Others/Vortex/vortex/src/MacOSX/../../src/vortex_thread_pool.c:99
#2  0x92bccc55 in _pthread_start ()
#3  0x92bccb12 in thread_start ()
(gdb) print channel
$1 = (VortexChannel *) 0x0

And here's a patch that fixes the crash. It also keeps the null  
channel from being refed and unrefed, which creates one of the  
warnings shown above. (There's also an unrelated bit that adds the  
channel number to a logging message; this was something I did a while  
ago that I found helpful.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: JensAlfke-channel_new-crash-fix.patch
Type: application/octet-stream
Size: 1450 bytes
Desc: not available
Url : http://lists.aspl.es/pipermail/vortex/attachments/20080408/a436feeb/attachment.obj 
-------------- next part --------------



—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://lists.aspl.es/pipermail/vortex/attachments/20080408/a436feeb/attachment.bin 


More information about the Vortex mailing list