Skip to content

Commit

Permalink
Fix crash reading module_entry after DL_UNLOAD() when module already …
Browse files Browse the repository at this point in the history
…loaded

This occurs when the handle is different from the current handle (e.g. copy of the .so file), hence the existing test did not catch that particular case.
  • Loading branch information
bwoebi committed Nov 9, 2022
1 parent 37b3e37 commit a814afb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/standard/dl.c
Expand Up @@ -206,8 +206,8 @@ PHPAPI int php_load_extension(const char *filename, int type, int start_now)
}
module_entry = get_module();
if (zend_hash_str_exists(&module_registry, module_entry->name, strlen(module_entry->name))) {
DL_UNLOAD(handle);
zend_error(E_CORE_WARNING, "Module \"%s\" is already loaded", module_entry->name);
DL_UNLOAD(handle);
return FAILURE;
}
if (module_entry->zend_api != ZEND_MODULE_API_NO) {
Expand Down

0 comments on commit a814afb

Please sign in to comment.