Jump to content

Obsolete:PHP 4.4.x heap corruption/debug

From Wikitech
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This page contains historical information. It may be outdated or unreliable.

Gentoo GNU/Linx ppc32

Test 1

<?php
        class C { var $m1, $m2, $m3, $m4, $m5, $m6; }
        ini_set( 'memory_limit', -1 );
        $a = array();
        for ( $i=0; $i<100000; $i++) $a[] = new C;
?>

Output

23% avar@Rancorwe /tmp/php/php4-STABLE-200601070135 $ sapi/cli/php -n /tmp/tst1.php 

[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x102599B0 status:
Beginning:      Overrun (magic=0x11E7DA58, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x10259970 status:
Beginning:      Overrun (magic=0x102599A8, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x1025FC80 status:
Beginning:      Overrun (magic=0x10259968, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x1025FD18 status:
Beginning:      Overrun (magic=0x1025FC78, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x1025FDB0 status:
Beginning:      Overrun (magic=0x1025FD10, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
[Sat Jan  7 02:52:39 2006]  Script:  '/tmp/tst1.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x1025FE48 status:
Beginning:      Overrun (magic=0x1025FDA8, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------

Test 2

<?php
        $t = array( 'm1' => null, 'm2' => null, 'm3' => null, 'm5' => null, 'm6' => null );
        ini_set( 'memory_limit', -1 );
        $a = array();
        for ( $i=0; $i<100000; $i++) $a[] = $t;
?>

Output

23% avar@Rancorwe /tmp/php/php4-STABLE-200601070135 $ sapi/cli/php -n /tmp/tst2.php 
[Sat Jan  7 02:53:25 2006]  Script:  '/tmp/tst2.php'
---------------------------------------
/tmp/php/php4-STABLE-200601070135/Zend/zend_execute.h(44) : Block 0x1025EF98 status:
Beginning:      Cached (allocated on /tmp/php/php4-STABLE-200601070135/Zend/zend_execute.c:512, 16 bytes)
      End:      OK
---------------------------------------