[php-src] Issue #13181: segfault in `php_load_extension` when `get_module` returns NULL
| From: | ju1ius | Date: | Wed, 17 Jan 2024 17:13:08 +0000 |
| Subject: | [php-src] Issue #13181: segfault in `php_load_extension` when `get_module` returns NULL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246284@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13181
Author: ju1ius
### Description
When the
get_module symbol of a shared library returns a null pointer:
```c
ZEND_DLEXPORT zend_module_entry* get_module(void) {
return NULL;
}
```
PHP crashes with a segfault because php_load_extension [directly
dereferences](https://heap.space/xref/php-src/ext/standard/dl.c?r=8a812c3f#207) the null pointer.
But I expected no crash and a warning message saying that the module could not be loaded.
### PHP Version
php8.3-dev
### Operating System
irrelevant