PHP 4.0 Bug #3160: crash in filesize
| From: | stas at zend dot com | Date: | Mon, 10 Jan 2000 17:07:58 +0000 |
| Subject: | PHP 4.0 Bug #3160: crash in filesize | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14467@lists.php.net to get a copy of this message | ||
From: stas@zend.com
Operating system: Linux
PHP version: 4.0 Latest CVS (10/01/2000)
PHP Bug Type: Reproduceable crash
Bug description: crash in filesize
Script:
<?
$proxy = "SOME_HTTP_PROXY";
$sock = pfsockopen($proxy, 8080);
fputs($sock,"GET SOME_FTP_URL HTTP/1.0\n\n");
echo filesize($sock);
?>
crashes PHP (tested on command line).
Stack trace:
#0 0x80adffa in php_stat (filename=0x0, type=2, return_value=0x812a730)
at filestat.c:413
413 BG(CurrentStatLength) = strlen(filename);
(gdb) where
#0 0x80adffa in php_stat (filename=0x0, type=2, return_value=0x812a730)
at filestat.c:413
#1 0x80ae7b3 in php_if_filesize (ht=1, return_value=0x812a730,
list=0x8105834, plist=0x8105860, this_ptr=0x0, return_value_used=1)
at filestat.c:550
#2 0x80beb45 in execute (op_array=0x8125230) at ./zend_execute.c:1525
#3 0x8080697 in execute_new_code () at zend_execute_API.c:538
#4 0x80baa22 in zendparse () at ./zend-parser.y:151
#5 0x808aebc in v_compile_files (mark_as_ref=0, file_count=3,
files=0xbffff7fc) at ./zend-scanner.l:355
#6 0x808adf2 in compile_files (mark_as_ref=0, file_count=3)
at ./zend-scanner.l:325
#7 0x80761a3 in php_execute_script (primary_file=0xbffff884) at main.c:1269
#8 0x8059dd1 in main (argc=2, argv=0xbffff8e4) at cgi_main.c:476
The bug is obvious - filename is zero, strlen won't work.