From:             imprec at gmail dot com
Operating system: OSX
PHP version:      5.5.3
Package:          FTP related
Bug Type:         Bug
Bug description:ftp_nb_continue produces segfault

Description:
------------
Running the following code on my OSX produces a segfault, see backtrace 

(gdb) (gdb) Starting program: /usr/local/bin/php
/Users/romain/ftp-script.php
Reading symbols for shared libraries 
+++++++++++++++++++++............................................... done
Reading symbols for shared libraries ...................... done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries ....... done
Reading symbols for shared libraries ..... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x0000000100387a75 in _php_stream_write ()
(gdb) #0  0x0000000100387a75 in _php_stream_write ()
No symbol table info available.
#1  0x000000010013ab6f in ftp_nb_continue_read ()
No symbol table info available.
#2  0x0000000100137c2c in zif_ftp_nb_continue ()
No symbol table info available.
#3  0x00000001003bf524 in dtrace_execute_internal ()
No symbol table info available.
#4  0x00000001004430c2 in zend_do_fcall_common_helper_SPEC ()
No symbol table info available.
#5  0x00000001003f310a in execute_ex ()
No symbol table info available.
#6  0x00000001003bf458 in dtrace_execute_ex ()
No symbol table info available.
#7  0x00000001003ce7ac in zend_execute_scripts ()
No symbol table info available.
#8  0x0000000100374602 in php_execute_script ()
No symbol table info available.
#9  0x0000000100467075 in do_cli ()
No symbol table info available.
#10 0x0000000100465e3d in main ()
No symbol table info available.
(gdb) %                          

Test script:
---------------
$connection = ftp_connect('hostname', 21);
ftp_login($connection, 'login', 'password');

$localfile = __DIR__ . '/ftpfile';
$start = file_exists($localfile) ? FTP_AUTORESUME : 0;

$result = ftp_nb_get($connection, $localfile, '/remotedir/remotefile',
FTP_BINARY, $start);

while ($result == FTP_MOREDATA) {
    $result = ftp_nb_continue($connection);
}

ftp_close($connection);


Expected result:
----------------
No seg fault

Actual result:
--------------
A seg fault

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65667&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65667&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65667&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65667&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65667&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65667&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65667&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65667&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65667&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65667&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65667&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65667&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65667&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65667&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65667&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65667&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65667&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65667&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65667&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65667&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65667&r=mysqlcfg

Reply via email to