php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23731 PHP Segfault
Submitted: 2003-05-21 04:11 UTC Modified: 2003-05-25 21:59 UTC
From: Borax at nerim dot net Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 4.3.1 OS: FreeBSD 5.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Borax at nerim dot net
New email:
PHP Version: OS:

 

 [2003-05-21 04:11 UTC] Borax at nerim dot net
Hi.

Before I say something, I scuse me for my poor english :)

I had a problem with a code which I made in order to filter a Cisco PIX's Syslog.

PHP segfault when I try to execute my script. I give you my script, and more informations about my system:

#! /bin/php

<?

/* D\xe9claration des variables */
$file    = (isset($file))? $file : "/var/log/test";
$i       = 0;
$j       = 0;

function tri($file){
        /* On ouvre le fichier et on met son contenu dans un tableau */
        $fd   = file($file);

        /* R\xe9cup\xe9ration des lignes qui concernent le PIX */
        foreach($fd as $id => $texte){
                if(ereg("PIX", $texte)){
                        $tableau[$i] = $texte;
                        $i++;
                }
        }

        /* Puis on traite chaque ligne valide */
        foreach($tableau as $ident => $contenu){
                /* On casse la chaine a chaque espace */
                unset($buff);
                $buff = explode(" ", $contenu);

                /* On d\xe9finit les variables qui vont correspondre : */
                $buff[0]  = $mois;
                $buff[1]  = $jour;
                $buff[2]  = $heure;
                $buff[3]  = $syslog_serv;
                $buff[4]  = $syslog_hdr;
                $buff[5]  = $deny;
                $buff[6]  = $inbound;
                $buff[7]  = $xlate1;$buff[8]  = $xlate2;
                $xlate    = $xlate1.$xlate2;
                $buff[9]  = $protocole;
                $buff[11] = $src;
                $source   = explode("/", $src);
                        $src_ip   = $source[0];
                        $src_port = $source[1];
                $buff[13] = $dst;
                $dest     = explode("/", $dst);
                        $dst_port = $dest[1];
                        $dst_ip   = $dest[0];
                
                /* On place tout ca dans une structure pour renvoyer le resultat */
                $structure[$j] = array( "src_ip"   => $src_ip,
                                        "src_port" => $src_port,
                                        "dst_ip"   => $dst_ip,
                                        "dst_port" => $dst_port,
                                        "proto"    => $protocole,
                                        "mois"     => $mois,
                                        "jour"     => $jour,
                                        "heure"    => $heure,
                                        "serv"     => $syslog_serv,
                                        "hdr"      => $syslog_hdr
                                );
                $j++;
        }
                
        return($structure);
}
                
$array = tri($file);
for($k = 0; $buff[$k]; $k++){
        echo $buff[$k]["src_ip"];
}
?>

When I execute that, PHP return to me:

neron# ./firewall.php
Content-type: text/html
X-Powered-By: PHP/4.3.1


Segmentation fault (core dumped)
neron# php -v
PHP 4.3.1 (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
neron# uname -sr
FreeBSD 5.0-RELEASE
neron#

I think it's suffisant to expose the problem.

If you want something else, you can mail me at Borax@nerim.net

Thanx for PHP, and goodbye.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-21 04:18 UTC] moriyoshi@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2003-05-25 21:59 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

And if you happen to be able to reproduce this with latest stable snapshot, please send us a short, self-contained and complete script which we can just copy'n'paste..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC