summaryrefslogtreecommitdiff
path: root/ext/standard/dl.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2019-03-31 14:01:36 +0200
committerAnatol Belski <ab@php.net>2019-03-31 14:26:00 +0200
commitddce7ada4c319dafa5cead0c0fb560a659f0763e (patch)
tree55a3992898232d92244b34574249fe5ac6809916 /ext/standard/dl.c
parent2733420f82a1ec5a6c8f1c1721efb0d5e186c0e9 (diff)
downloadphp-git-ddce7ada4c319dafa5cead0c0fb560a659f0763e.tar.gz
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.
Diffstat (limited to 'ext/standard/dl.c')
-rw-r--r--ext/standard/dl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 226474efbf..ddc87a40d0 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -167,6 +167,16 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
efree(err1);
}
+#ifdef PHP_WIN32
+ if (!php_win32_image_compatible(libpath, NULL, &err1)) {
+ php_error_docref(NULL, error_type, err1);
+ efree(err1);
+ efree(libpath);
+ DL_UNLOAD(handle);
+ return FAILURE;
+ }
+#endif
+
efree(libpath);
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");