php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56327 segmentaion fault
Submitted: 2005-02-25 05:55 UTC Modified: 2005-10-23 09:25 UTC
From: fsemkin at yandex dot ru Assigned:
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 5.0.3 OS: RedHat Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-02-25 05:55 UTC] fsemkin at yandex dot ru
Description:
------------
libssh2-0.6 and later causes "segmentation fault"

Reproduce code:
---------------
This is my implementaion of SSH2 class:
http://81.195.80.186/cssh2.ph

$ssh2 = new CSSH2;
$ssh2->GetShell($host, $port, $login, $password, "vt102");
$result = $ssh2->Execute("echo OK");

libssh2-0.5 works fine, but older versions always cause "segmentation fault"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-25 14:31 UTC] pollita@php.net
What version of PECL/ssh2 are you using, and did you recompile PECL/ssh2 after upgrading libssh2.

A backtrace would also help:
http://bugs.php.net/bugs-generating-backtrace.php
 [2005-06-02 11:21 UTC] therebel at free dot fr
I hav the same problem on Debian Sarge :

PHP 5.0.4-1.dotdeb.1 (cli) (built: Apr 14 2005 10:23:01)
libssh2-0.10
PECL/ssh2 Version 0.8 (installed with pear install ssh2)

Segmentation fault on this line :

$connection = ssh2_connect($host , 22);

Any idea ??
 [2005-06-02 14:31 UTC] pollita@php.net
therebel@free.fr

I'll have an idea when someone submits a backtrace.
 [2005-06-02 16:35 UTC] therebel at free dot fr
I have compiled my own php5 version from source :
./configure --enable-cli --enable-debug;make;make install
Then i hav compiled PECL/ssh2 Version 0.8 without pear (with debug)

When i was ready to get the backtrace :
gdb php5
run script.php

It works!

So problem come from binaries PHP 5.0.4-1 from dotdeb
 [2005-06-07 15:26 UTC] robelsner at ngfc dot com
(gdb) run ssh.php
Starting program: /usr/local/bin/php ssh.php
[New Thread 1024 (LWP 8882)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 8882)]
0x41014674 in chunk_free () from /lib/libc.so.6
(gdb) bt
#0  0x41014674 in chunk_free () from /lib/libc.so.6
#1  0x410145f6 in free () from /lib/libc.so.6
#2  0x41225802 in T_free () from /usr/lib/libnnz10.so
#3  0x4118afdc in R_free () from /usr/lib/libnnz10.so
#4  0x411869a4 in BN_rand () from /usr/lib/libnnz10.so
#5  0x45259c66 in libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange (session=0x8323a34, g=0x831ec18, p=0x8323b50,
    packet_type_init=32 ' ', packet_type_reply=33 '!', midhash=0x831ec3d "", midhash_len=265) at kex.c:88
#6  0x4525b5ab in libssh2_kex_method_diffie_hellman_group_exchange_sha1_key_exchange (session=0x8323a34) at kex.c:639
#7  0x4525c917 in libssh2_kex_exchange (session=0x8323a34, reexchange=0) at kex.c:1266
#8  0x452608e9 in libssh2_session_startup (session=0x8323a34, socket=16777233) at session.c:321
#9  0x45216f18 in php_ssh2_session_connect (host=0x5 <Address 0x5 out of bounds>, port=137509428, methods=0x0,
    callbacks=0x0) at /tmp/tmpx6xOpc/ssh2-0.8/ssh2.c:419
#10 0x4521751b in zif_ssh2_connect (ht=2, return_value=0x8314aec, this_ptr=0x0, return_value_used=1)
    at /tmp/tmpx6xOpc/ssh2-0.8/ssh2.c:449
#11 0x081ca5f5 in zend_do_fcall_common_helper (execute_data=0xbfffd360, opline=0x83228fc, op_array=0x831e6bc)
    at /root/php-5.0.4/Zend/zend_execute.c:2727
#12 0x081c77c2 in execute (op_array=0x831e6bc) at /root/php-5.0.4/Zend/zend_execute.c:1406
#13 0x081aaeeb in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /root/php-5.0.4/Zend/zend.c:1069
#14 0x08179fb8 in php_execute_script (primary_file=0xbffff700) at /root/php-5.0.4/main/main.c:1632
#15 0x081d293e in main (argc=2, argv=0xbffff794) at /root/php-5.0.4/sapi/cli/php_cli.c:946
#16 0x40fbe4a2 in __libc_start_main () from /lib/libc.so.6
(gdb)
 [2005-06-07 19:15 UTC] pollita@php.net
What other modules are you building into PHP?  Is OCI8 one of them?
 [2005-06-07 22:24 UTC] robelsner at ngfc dot com
For my config, 
Configure Command =>  './configure' '--with-oci8=/usr' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-gd' '--enable-gd-native-ttf' '--with-zlib' '--with-jpeg-dir' '--with-freetype-dir=/usr/local' '--with-xpm-dir=/usr/X11R6' '--with-curl' '--with-mysql' '--enable-pcntl'

IS there an existing bug with this problem?
 [2005-10-23 09:25 UTC] mike@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2007-06-02 06:07 UTC] mike at oeg dot com dot au
radius2:/opt/webshield/tools# gdb php               
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...(no debugging symbols found)...
(gdb) run -f ./ssh2.php
Starting program: /usr/bin/php5 -f ./ssh2.php
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...[New Thread 1024 (LWP 24875)]
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 24875)]
0xb7d7357d in BN_num_bits () from /usr/lib/libcrypto.so.0.9.6
(gdb) bt
#0  0xb7d7357d in BN_num_bits () from /usr/lib/libcrypto.so.0.9.6
#1  0xb7decfc4 in TXT_DB_version () from /usr/lib/libcrypto.so.0.9.6
#2  0xb79b09af in libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange (session=0x84eacc4, g=0x84eb298, p=0x84eb280, group_order=193, packet_type_init=32 ' ', packet_type_reply=33 '!', 
    midhash=0x84eb83d "", midhash_len=202) at kex.c:291
#3  0xb79b1afc in libssh2_kex_method_diffie_hellman_group_exchange_sha1_key_exchange (session=0x84eacc4) at kex.c:663
#4  0xb79b2d8c in libssh2_kex_exchange (session=0x84eacc4, reexchange=0) at kex.c:1320
#5  0xb79b8f0c in libssh2_session_startup (session=0x84eacc4, socket=7) at session.c:340
#6  0xb79c8673 in php_ssh2_session_connect (host=0x84eabe4 "202.191.99.77", port=22, methods=0x0, callbacks=0x0) at /tmp/tmp9cwHEI/ssh2-0.10/ssh2.c:424
#7  0xb79c874c in zif_ssh2_connect (ht=4, return_value=0x84eac24, this_ptr=0x0, return_value_used=1) at /tmp/tmp9cwHEI/ssh2-0.10/ssh2.c:455
#8  0x0823c4da in zend_do_fcall_common_helper ()
#9  0x0823cb11 in zend_do_fcall_handler ()
#10 0x08224cb5 in execute ()
#11 0x08207e28 in zend_execute_scripts ()
#12 0x081d8bca in php_execute_script ()
#13 0x0824c3f4 in main ()
#14 0xb7a8114f in __libc_start_main () from /lib/libc.so.6
(gdb)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 14:01:30 2024 UTC