Skip to content

Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list #16101

Closed

Description

@Girgias

Description

The following code:

<?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

Activity

  1. self-assigned this
    on Sep 28, 2024
  2. added a commit that references this issue on Sep 28, 2024
    44f48dc
  3. added 5 commits that reference this issue on Sep 28, 2024
    0f2fe67
    16b272d
    8d1a791
    19bba83
    d354c14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions