[php-maint] Bug#487283: [php5] recursive foreach loop causes php segfault

Frederik Reiß frederik.reiss at gmx.de
Fri Jun 20 19:20:20 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: php5
Version: 5.2.6-1
Severity: grave

- --- Please enter the report below this line. ---

The following code causes php 5.2 to segfault (at least i386 stable
5.2.0-8+etch11 and amd64 testing/unstable 5.2.6-1 testing/unstable).

<?php
$a=array( array() );
xyzloop($a);
function xyzloop($a)
{
  foreach($a as $devnull){
    xyzloop($a);
  }
}
?>


Even if the recursion is not infinite php crasches after "some"
iterations (32 - ~16000) depending on the context and the content of the
foreach loop.

I know, xyzloop($a) in the foreach loop should be xyzloop($devnull), but
nevertheless php shouldn't segfault in _ANY_ case.

- --- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.24-1-amd64

Debian Release: lenny/sid
  900 testing         www.debian-multimedia.org
  900 testing         ftp2.de.debian.org
    1 unstable        www.debian-multimedia.org
    1 unstable        ftp2.de.debian.org
    1 experimental    www.debian-multimedia.org
    1 experimental    ftp2.de.debian.org

- --- Package information. ---
Depends                     (Version) | Installed
=====================================-+-==============
libapache2-mod-php5     (>= 5.2.4-2)  |
 OR php5-cgi             (>= 5.2.4-2) |
php5-common              (>= 5.2.4-2) | 5.2.6-1

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIXAL0cLHece3p3gARAmy+AKCGk1OnEn+7AUcOM30B9sdaAPW2PwCfbq8P
poKS97BE/f0lqIKDuwxELPc=
=4CLJ
-----END PGP SIGNATURE-----





More information about the pkg-php-maint mailing list