Bug #54935 [Opn->Csd]: php_win_err can lead to crash
Edit report at http://bugs.php.net/bug.php?id=54935&edit=1
ID: 54935
Updated by: pajoye@php.net
Reported by: freddy77 at gmail dot com
Summary: php_win_err can lead to crash
-Status: Open
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Windows
PHP Version: 5.3.6
-Assigned To:
+Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-05-26 16:37:17] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=311444
Log: -fix bug 54935, php_win_err can lead to crash
------------------------------------------------------------------------
[2011-05-26 14:32:02] freddy77 at gmail dot com
Description:
------------
Under Windows if php fail to load an extension apache crash.
Looking at code I discovered that php_win_err is wrong (I don't know if
this fix my problem).
In win32/winutil.c
PHPAPI char *php_win_err(int error)
{
char *buf = NULL;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&buf, 0, NULL
);
return (buf ? (char *) buf : "");
}
now if FormatMessage fails buf is NULL and a "" is returned however in
ext/standard/dl.c a LocalFree is called if err (php_win_err result) is
not NULL.
Expected result:
----------------
Program should report error and not crash
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54935&edit=1
Thread (2 messages)