From:             [EMAIL PROTECTED]
Operating system: Mac OS X 10.3
PHP version:      4CVS-2004-02-08 (stable)
PHP Bug Type:     Filesystem function related
Bug description:  userland stream wrapper segfaults on stream_write

Description:
------------
Stream Wrapper defined in PHP Userland segfaults on fwrite (see code).

Couldn't reproduce it on Linux, only on OS X :(



Reproduce code:
---------------
stream_wrapper_register("one", "StreamOne");
$fd = fopen("one://tmp/bla","w");
$bla = fwrite($fd, "test");
fclose($fd);
class StreamOne {
    function stream_open ($path, $mode, $options, &$opened_path) {
        return true;
    }
    function stream_write($data) {
        return strlen($data);
    }
    function stream_close() {
        return true;
    }    
}

Expected result:
----------------
nothing

Actual result:
--------------
segfault.

Backtrace:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x000cc36c in _efree (ptr=0xbfffea40) at
/opt/cvs/php4/Zend/zend_alloc.c:259
259             REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0  0x000cc36c in _efree (ptr=0xbfffea40) at
/opt/cvs/php4/Zend/zend_alloc.c:259
#1  0x000d4408 in call_user_function_ex (function_table=0x0,
object_pp=0x115d6e0, function_name=0xbfffea30, retval_ptr_ptr=0xbfffea54,
param_count=1411044, params=0x0, no_separation=0, symbol_table=0x0) at
/opt/cvs/php4/Zend/zend_execute.h:96
#2  0x000d4408 in call_user_function_ex (function_table=0x0,
object_pp=0x115d6e0, function_name=0xbfffea30, retval_ptr_ptr=0xbfffea54,
param_count=1411044, params=0x0, no_separation=0, symbol_table=0x0) at
/opt/cvs/php4/Zend/zend_execute.h:96
#3  0x000c2c58 in php_userstreamop_write (stream=0xbfffea40, buf=0x115e790
"\001\025çp\001\025è", count=18188432) at
/opt/cvs/php4/main/user_streams.c:396
#4  0x000bbb2c in _php_stream_write (stream=0x115e6f0, buf=0x115db90
"test", count=4) at /opt/cvs/php4/main/streams.c:913
#5  0x0006b918 in zif_fwrite (ht=1075232, return_value=0x0,
this_ptr=0x158bbc, return_value_used=-1073748124) at
/opt/cvs/php4/ext/standard/file.c:1602
#6  0x000eaca8 in execute (op_array=0x115d6e0) at
/opt/cvs/php4/Zend/zend_execute.c:1621
#7  0x000dcbc0 in zend_execute_scripts (type=-1073747392, retval=0x0,
file_count=3) at /opt/cvs/php4/Zend/zend.c:884
#8  0x000b275c in php_execute_script (primary_file=0xbffff630) at
/opt/cvs/php4/main/main.c:1727
#9  0x000efbc4 in main (argc=2, argv=0xbffffb4c) at
/opt/cvs/php4/sapi/cli/php_cli.c:822

-- 
Edit bug report at http://bugs.php.net/?id=27183&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27183&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27183&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27183&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27183&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27183&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27183&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27183&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27183&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27183&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27183&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27183&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27183&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27183&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27183&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27183&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27183&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27183&r=float

Reply via email to