mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Implement stricter extension compatibility check
This hardens the dynamic module loading by checking the linker compatibility between the core and the dynamic module. This likely should be extended for the CRT as well, as 2015, 2017 and 2019 versions of Visual Studio all have same DLL name for the CRT.
This commit is contained in:
parent
2733420f82
commit
ddce7ada4c
4 changed files with 66 additions and 0 deletions
|
@ -339,6 +339,13 @@ static void php_load_zend_extension_cb(void *arg)
|
|||
#endif
|
||||
|
||||
if (IS_ABSOLUTE_PATH(filename, length)) {
|
||||
#ifdef PHP_WIN32
|
||||
char *err;
|
||||
if (!php_win32_image_compatible(filename, NULL, &err)) {
|
||||
php_error(E_CORE_WARNING, err);
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
zend_load_extension(filename);
|
||||
} else {
|
||||
DL_HANDLE handle;
|
||||
|
@ -384,6 +391,16 @@ static void php_load_zend_extension_cb(void *arg)
|
|||
efree(err1);
|
||||
}
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
if (!php_win32_image_compatible(libpath, NULL, &err1)) {
|
||||
php_error(E_CORE_WARNING, err1);
|
||||
efree(err1);
|
||||
efree(libpath);
|
||||
DL_UNLOAD(handle);
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
zend_load_extension_handle(handle, libpath);
|
||||
efree(libpath);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue