[php-src] Issue #16101: Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list
| From: | Girgias | Date: | Sat, 28 Sep 2024 15:05:48 +0000 |
| Subject: | [php-src] Issue #16101: Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247928@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/16101
Author: Girgias
### Description
The following code:
```php
<?php
/* We are assuming 3333 is not connectable */
$ldap = ldap_connect('ldap://127.0.0.1:3333');
$valid_dn = "cn=userA,something";
$valid_filter = "";
$ldaps_dict = [
"hello" => $ldap,
"world" => $ldap,
];
try {
var_dump(ldap_list($ldaps_dict, $valid_dn, $valid_filter));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
```
Resulted in this output:
```
php: /home/girgias/Dev/PHP-8.2/Zend/zend_hash.c:2626: zend_hash_internal_pointer_reset_ex: Assertion
`(&ht->nInternalPointer != pos || zend_gc_refcount(&(ht)->gc) == 1) ||
((ht)->u.flags & (1<<6))' failed.
Termsig=6
```
But I expected this output instead:
```
ValueError: ldap_list(): Argument #1 ($ldap) must be a list
```
### PHP Version
PHP 8.2
### Operating System
_No response_