ID:               49767
 User updated by:  mb at smartftp dot com
 Reported By:      mb at smartftp dot com
 Status:           Assigned
 Bug Type:         Reproducible crash
 Operating System: Windows 2008 SP2 x86
 PHP Version:      5.3.0
 Assigned To:      pajoye
 New Comment:

I have also sent you the crash report by email. Open the .mht file (RS
removed the .mth extension for some reason) with IE.


Previous Comments:
------------------------------------------------------------------------

[2009-10-04 19:25:46] [email protected]

I corrected myself about the script by asking for the full bt (the one
on RS was not readable).

The diagnostic sounds good, I have to reproduce it to be sure. Assigned
to me.

------------------------------------------------------------------------

[2009-10-04 17:28:20] mb at smartftp dot com

I don't think you need a script. A little bit of time and motivation
would do as well:

Please review your code:

File: main.c
PHPAPI int php_execute_script(zend_file_handle *primary_file
TSRMLS_DC)
{
...
#ifdef PHP_WIN32
                UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);
#endif
..
}

Then:
File: registry.c
void UpdateIniFromRegistry(char *path TSRMLS_DC)
{
-> BUG: missing check for argument

// here comes the check for Per Directory registry value. If it is not
found the function exists and never comes to the estrdup and hence no
crash.
...
        orig_path = path = estrdup(path);
..
}

The problem only happens if the "Per Directory Values" registry key is
present. In this case estrdup(NULL) is called and you get the crash.

So I think the argument (path) should be checked for NULL. And when I
look at the main.c I also noticed that you sometimes expect the
primary_file->filename to be null, so maybe you add a check before the
UpdateIniFromRegistry() call.

Proposed FIX:
#ifdef PHP_WIN32
if(primary_file->filename)
{
                UpdateIniFromRegistry(primary_file->filename TSRMLS_CC);
}
#endif

+ Add argument check for UpdateIniFromRegistry

Workaround:
Remove "Per Directories Values" registry key.

Regards,
Mat

------------------------------------------------------------------------

[2009-10-04 17:23:34] [email protected]

Btw, can you also zip the report and send it to me or provide a link to
the zip (pls not one of these radidshare thing) :)

------------------------------------------------------------------------

[2009-10-04 17:21:26] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2009-10-04 17:09:37] mb at smartftp dot com

Trimmed URL:
http://trim-url.com/?gW

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/49767

-- 
Edit this bug report at http://bugs.php.net/?id=49767&edit=1

Reply via email to