From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.2.0
PHP Bug Type:     Session related
Bug description:  reallocating memory causes segfaults

<?php
    session_register( "_SESSION" );
    $_SESSION = "kk";
?>

backtrace:

#0  0x08189910 in zend_hash_get_current_key_ex (ht=0x82d5654, 
    str_index=0xbfffe984, str_length=0xbfffe980, num_index=0xbfffe97c, 
    duplicate=0 '\000', pos=0xbfffe988) at zend_hash.c:1035

#1  0x080fed0e in php_session_save_current_state ()
#2  0x08101855 in php_session_flush ()
#3  0x08101895 in zm_deactivate_session ()
#4  0x08186aee in module_registry_cleanup (module=0x8285ed0) at
zend_API.c:1169
#5  0x08188f0a in zend_hash_apply (ht=0x82349a0, 
    apply_func=0x8186aa6 <module_registry_cleanup>) at zend_hash.c:669
#6  0x08183e14 in zend_deactivate_modules () at zend.c:581
#7  0x08077658 in php_request_shutdown ()
#8  0x08075997 in main ()
#9  0x4037a4f2 in __libc_start_main () from /lib/libc.so.6

The problem however appears earlier.
It seems that the zval structure ps_globals.http_session_vars points at is
freed and allocated elsewhere, but ps_globals.http_session_vars
points to the old location, so when it comes to
php_session_save_current_state (#1),
Z_ARRVAL_P(PS(http_session_vars)) holds some meaningless value.

-- 
Edit bug report at http://bugs.php.net/?id=16995&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16995&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16995&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16995&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16995&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16995&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16995&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16995&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16995&r=submittedtwice

Reply via email to