Bug #17379: proc_close() causes segmentation fault

From: Date: Thu, 23 May 2002 08:14:45 +0000
Subject: Bug #17379: proc_close() causes segmentation fault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-8297@lists.php.net to get a copy of this message
From: kims@contrail.com.au Operating system: Debian GNU/Linux PHP version: 4.0CVS-2002-05-23 PHP Bug Type: Reproducible crash Bug description: proc_close() causes segmentation fault proc_close() is causing a segmentation fault in php when I call it with a valid resource (it gives a correct warning if you pass it a null value. Here's some PHP that causes a segfault for me: <? $ds = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/tmp/stderr", "a") ); $cat = proc_open( "/bin/cat", $ds, $pipes ); proc_close($cat); echo "I didn't segfault!\n"; ?> And here's a backtrace: kims@lionred:~/public_html$ gdb /usr/local/bin/php core 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"... Core was generated by `php sf.php'. Program terminated with signal 11, Segmentation fault. Reading symbols from /lib/libcrypt.so.1...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /lib/libresolv.so.2...done. Loaded symbols for /lib/libresolv.so.2 Reading symbols from /lib/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/libpthread.so.0...done. Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 #0 0x081593b2 in zend_fetch_resource (passed_id=0x820aae8, tsrm_ls=0x81d6600, default_id=-1, resource_type_name=0x81937a4 "process", found_resource_type=0x0, num_resource_types=1) at /home/kims/php4/Zend/zend_list.c:123 123 } else if ((*passed_id)->type != IS_RESOURCE) { (gdb) bt #0 0x081593b2 in zend_fetch_resource (passed_id=0x820aae8, tsrm_ls=0x81d6600, default_id=-1, resource_type_name=0x81937a4 "process", found_resource_type=0x0, num_resource_types=1) at /home/kims/php4/Zend/zend_list.c:123 #1 0x080c35c6 in zif_proc_close (ht=1, return_value=0x820f9c8, this_ptr=0x0, return_value_used=0, tsrm_ls=0x81d6600) at /home/kims/php4/ext/standard/exec.c:601 #2 0x08167779 in execute (op_array=0x820aa20, tsrm_ls=0x81d6600) at /home/kims/php4/Zend/zend_execute.c:1587 #3 0x08152fdf in zend_execute_scripts (type=8, tsrm_ls=0x81d6600, retval=0x0, file_count=3) at /home/kims/php4/Zend/zend.c:810 #4 0x08125dea in php_execute_script (primary_file=0xbffffd48, tsrm_ls=0x81d6600) at /home/kims/php4/main/main.c:1373 #5 0x0817019b in main (argc=2, argv=0xbffffdc4) at /home/kims/php4/sapi/cli/php_cli.c:622 (gdb) Thankyou. -- Edit bug report at http://bugs.php.net/?id=17379&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17379&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17379&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17379&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17379&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17379&r=support Expected behavior: http://bugs.php.net/fix.php?id=17379&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17379&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17379&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17379&r=globals

« previous php.bugs (#8297) next »