From:             stas
Operating system: MacOS X 10.6.6
PHP version:      5.3SVN-2011-03-16 (snap)
Package:          Reproducible crash
Bug Type:         Bug
Bug description:crash when variable gets reassigned in error handler

Description:
------------
Reported by Christian Holler on mailing list, the code below produces
invalid 

memory access due to the fact that the line:



if (!Z_OBJ_HT_P(object)->write_property) {



tries to access handler table of the object variable while it's not an
object and 

is not initialized. 

Test script:
---------------
<?php

function my_errorhandler($errno,$errormsg) {

  global $my_var;

  $my_var = 0;

}

set_error_handler("my_errorhandler");

$my_var = str_repeat("A",$my_var[0]->errormsg = "xyz");



Actual result:
--------------
==81019== Invalid read of size 4

==81019==    at 0x563FE7: zend_assign_to_object (in /Users/smalyshev/mphp)

==81019==    by 0x563C0A: ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER (in 

/Users/smalyshev/mphp)

==81019==    by 0x53AACF: execute (in /Users/smalyshev/mphp)

==81019==    by 0x510740: zend_execute_scripts (in /Users/smalyshev/mphp)

==81019==    by 0x49D190: php_execute_script (in /Users/smalyshev/mphp)

==81019==    by 0x5D2C35: main (in /Users/smalyshev/mphp)

==81019==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

==81019== 



-- 
Edit bug report at http://bugs.php.net/bug.php?id=54265&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54265&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54265&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54265&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54265&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54265&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54265&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54265&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54265&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54265&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54265&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54265&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54265&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54265&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54265&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54265&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54265&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54265&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54265&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54265&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54265&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54265&r=mysqlcfg

Reply via email to