Bug #16939: emalloc causes segfault (example uses tokenizer)
| From: | alan at akbkhome dot com | Date: | Wed, 01 May 2002 06:40:24 +0000 |
| Subject: | Bug #16939: emalloc causes segfault (example uses tokenizer) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-6608@lists.php.net to get a copy of this message | ||
From: alan@akbkhome.com
Operating system: linux
PHP version: 4.2.0
PHP Bug Type: Reproducible crash
Bug description: emalloc causes segfault (example uses tokenizer)
A short script to reproduce this
(sorry it not to easy to reproduce without the exact code, I did at one
point get to the situation where adding a extra space in the white space
area solved this!), but I suspect it is that the machine is running low on
memory or something....
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/tools/uml_generator.class?rev=1.2&content-type=text/vnd.viewcvs-markup
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmole-ide/phpmole/tools/uml_dia.xml.php?rev=1.1&content-type=text/vnd.viewcvs-markup
-- just use it do do a large number of files. eg.
php uml_generator.class /usr/local/php/pear/
Possible reasons that I could think of:
-the tokenizer extension (which may be leaking memory)
-somewhere not exiting if no memory can be allocated and then emalloc /
malloc being called again.
Configuration on this machine (4.2.0RC2), also reproduced with 4.2 release
version
'./configure' '--prefix=/usr' '--without-mysql'
'--with-config-file-path=/etc/php4/cgi/' '--enable-dba' '--with-db2'
and tokenizer as a dl'd module
Backtrace
Program received signal SIGSEGV, Segmentation fault.
0x4014db2b in malloc () from /lib/libc.so.6
(gdb) bt
#0 0x4014db2b in malloc () from /lib/libc.so.6
#1 0x4014d1e4 in malloc () from /lib/libc.so.6
#2 0x80c4c5c in _emalloc (size=35) at zend_alloc.c:165
#3 0x80d4b1a in zend_hash_index_update_or_next_insert (ht=0x817ae9c,
h=207,
pData=0xbfffda28, nDataSize=4, pDest=0x0, flag=4) at zend_hash.c:404
#4 0x80d303a in add_next_index_stringl (arg=0x8326d64, str=0x8268c08 ")",
length=1,
duplicate=1) at zend_API.c:847
#5 0x401ffc61 in tokenize () from /usr/lib/php4/cgi/tokenizer.so
#6 0x402005ac in zif_token_get_all () from
/usr/lib/php4/cgi/tokenizer.so
#7 0x80eb4b0 in execute (op_array=0x816631c) at ./zend_execute.c:1598
#8 0x80eb679 in execute (op_array=0x8166a84) at ./zend_execute.c:1638
#9 0x80eb679 in execute (op_array=0x816004c) at ./zend_execute.c:1638
#10 0x80d19e8 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at zend.c:810
#11 0x805e1dd in php_execute_script (primary_file=0xbffffb98) at
main.c:1381
#12 0x805c0ac in main (argc=3, argv=0xbffffc14) at cgi_main.c:785
#13 0x400f86cf in __libc_start_main () from /lib/libc.so.6
--
Edit bug report at http://bugs.php.net/?id=16939&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16939&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16939&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16939&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16939&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16939&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16939&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16939&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16939&r=submittedtwice