#196: using libssh2_channel_read crushes
---------------------------------------------------------------------------------------+
  Reporter:  
www.google.com/accounts/o8/id?id=aitoawk50cbnsiuuqgylsi_oyi14_ymtafn1cjc  |     
  Owner:       
      Type:  defect                                                             
       |      Status:  new  
  Priority:  high                                                               
       |   Milestone:  1.2.7
 Component:  API                                                                
       |     Version:  1.2.7
  Keywords:                                                                     
       |      Blocks:       
Blocked By:                                                                     
       |  
---------------------------------------------------------------------------------------+
 Core was generated by `/users/ahirsh/libssh2-1.2.7/example/.libs/lt-sftp
 10.106.59.20'.
 Program terminated with signal 11, Segmentation fault.
 #0  _libssh2_transport_read (session=0xe7c7a88a) at transport.c:294
 294         session->socket_block_directions &=
 ~LIBSSH2_SESSION_BLOCK_INBOUND;
 while i was trying to use libssh2_channel_read in the proper way :
 ...
    int rc;
    int bytecount;
    do
    {
        char buffer[0x4000];
        cout<<"Before Block"<<endl;
        rc = libssh2_channel_read( channel, buffer, sizeof(buffer) );
        cout<<"After Block"<<endl;
        if( rc > 0 )
        {
             int i;
             bytecount += rc;
             fprintf(stdout, "We read:\n");
             for( i=0; i < rc; ++i )
                  fputc( buffer[i], stdout);
               fprintf(stdout, "\n");
        }
        else
        {
             fprintf(stdout, "libssh2_channel_read returned %d\n", rc);
        }

    }while( rc > 0);
 ...

 i encountered a crush with the below stack trace :


 Core was generated by `/users/ahirsh/libssh2-1.2.7/example/.libs/lt-sftp
 10.106.59.20'.
 Program terminated with signal 11, Segmentation fault.
 #0  _libssh2_transport_read (session=0xad8d6e50) at transport.c:294
 294         session->socket_block_directions &=
 ~LIBSSH2_SESSION_BLOCK_INBOUND;
 (gdb) bt
 #0  _libssh2_transport_read (session=0xe7c7a88a) at transport.c:294
 #1  0x00fc9658 in _libssh2_channel_read (channel=0xb6a00468, stream_id=0,
 buf=0xb7565fc4 "", buflen=16384) at channel.c:1693
 #2  0x00fc98fd in libssh2_channel_read_ex (channel=0xb6a00468,
 stream_id=0, buf=0xb7565fc4 "", buflen=16384) at channel.c:1844
 #3  0x0804bbcb in LibraryCheck (param=0x0) at sftp.c:382
 #4  0x00be343b in start_thread () from /lib/libpthread.so.0
 #5  0x00348fde in clone () from /lib/libc.so.6
 (gdb) quit

-- 
Ticket URL: <http://trac.libssh2.org/ticket/196>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to