Ticket #124 (closed defect)

Opened 8 years ago

Last modified 8 years ago

poll() and accept() segmentation fault

Reported by: juzna Owned by: bagder
Priority: normal Milestone:
Component: API Version:
Keywords: Cc: juzna, bagder
Blocked By: Blocks:


I'm using ssh2 module in PHP, and this module uses libssh2. When trying libssh2 version that comes in my distribution, poll a accept calls did deadlock and never finished. When trying git version, it did seg fault.

I've fixed the seg fault problem (in packet.c there was forgotted to assign value to listen_state->channel, which caused to write to null pointer) and partially also deadlock problem (in channel.c). It work's now only for non-blocking calls, someone who understand it better could fix it.

In channel_forward_accept(), the do-while is trying to read data from transport layer and when it reads all, it gots PACKET_EAGAIN error which causes to stop reading data and return. So it will never try to accept the connection. (at least I think so).

Sorry for problems, but it's my first patch made ever so I'm not sure whether I'm doing it correctly. And I also dont know how to commit changes to git, so I'm posting it here.
If someone wanna give me some advices about how to commit patches, I'd be glad. You can use my email juzna.cz at gmail dot com


libssh2.diff (1.4 KB) - added by juzna 8 years ago.

Download all attachments as: .zip

Change History

Changed 8 years ago by juzna


comment:1 Changed 8 years ago by bagder

Thanks for your report and help in improving libssh2!

A fix has just been committed to the source code repo, this case is now considered fixed and closed!

Note: See TracTickets for help on using tickets.