php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27895 Access violation while throwing exception
Submitted: 2004-04-06 22:14 UTC Modified: 2004-04-08 16:52 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: mes at zeroc dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2004-04-07 OS: Windows 2000/XP
Private report: No CVE-ID: None
 [2004-04-06 22:14 UTC] mes at zeroc dot com
Description:
------------
I'm using PHP 5.0.0RC1 and Apache 2.0.49 on Windows 2000 & XP. After executing the enclosed script a number of times, I eventually receive an Access Violation notice. Sometimes it happens after two executions, sometimes after 20, but it always happens.

I initially used the binary distributions of PHP5 and Apache, but I've also compiled Apache and PHP5 from sources using VC 6.0 and VC 7.0, with the same result. Unfortunately, the problem only appears when I compile in release mode, not in debug mode.

However, I believe the problem occurs in the first while loop of zend_fetch_debug_backtrace, where the args variable eventually points to an invalid location and is then dereferenced.

Reproduce code:
---------------
<HTML>
<HEAD>
    <TITLE>Access Violation Demo</TITLE>
</HEAD>
<BODY>

    <H1>Access Violation Demo</H1>

<?php

if(isset($_POST["submitted"]))
{
    echo "<HR>\n";
    echo "<P>Status:<BR><B>\n";
    try
    {
        throw new Exception;
    }
    catch(Exception $ex)
    {
        echo "<pre>\n";
        print_r($ex);
        echo "</pre>\n";
    }
    echo "</B></P>\n";
    echo "<HR>\n";
}
?>

    <P>
    <FORM method="POST" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>">
        <INPUT type="hidden" name="submitted" value="yes">
        <INPUT type="submit" name="Submit" value="Submit">
    </FORM>
</BODY>
</HTML>

Expected result:
----------------
Access violation dialog

Actual result:
--------------
Can't get a useful stack trace because it doesn't seem to happen in debug mode.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-07 05:14 UTC] sniper@php.net
Does not crash within Linux (debug/no-debug)

 [2004-04-07 05:15 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2004-04-07 14:54 UTC] mes at zeroc dot com
I tried again with the current snapshot, and got the same result.
 [2004-04-08 16:41 UTC] helly@php.net
See #27595
 [2004-04-08 16:52 UTC] derick@php.net
Duplicate bugs -> Bogus (The "Duplicate" status is no longer used)
 [2004-04-14 12:50 UTC] andareed at daemon-tools dot cc
As a note, you can get around this by wrapping the code in a try block. This crash also occurs randomly when calling debug_backtrace and debug_print_backtrace. If you modify release build to include debug info (in Zend project) you can see exactly where it happens.

I'm using XP SP1, apache 2.0.49, PHP 5.0.0RC1, all built from sources.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 20:01:31 2025 UTC