forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-8.4: NEWS entries for LDAP bug fixes ext/ldap: Fix phpGH-16136 (Memory leak in php_ldap_do_modify()) ext/ldap: Fix phpGH-16132 (Freeing pointer not allocated by ZMM)
- Loading branch information
Showing
4 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
Bug GH-16132: Attempting to free pointer not allocated by ZMM | ||
--EXTENSIONS-- | ||
ldap | ||
--FILE-- | ||
<?php | ||
|
||
/* ldap_add(_ext)(), ldap_mod_replace(_ext)(), ldap_mod_add(_ext)(), and ldap_mod_del(_ext)() share an underlying C function */ | ||
/* We are assuming 3333 is not connectable */ | ||
$ldap = ldap_connect('ldap://127.0.0.1:3333'); | ||
$valid_dn = "cn=userA,something"; | ||
|
||
$dict_key_value_not_string = [ | ||
'attribute1' => new stdClass(), | ||
'attribute2' => [ | ||
'value1', | ||
'value2', | ||
], | ||
]; | ||
try { | ||
var_dump(ldap_add($ldap, $valid_dn, $dict_key_value_not_string)); | ||
} catch (Throwable $e) { | ||
echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
Error: Object of class stdClass could not be converted to string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
Bug GH-16132: Attempting to free pointer not allocated by ZMM | ||
--EXTENSIONS-- | ||
ldap | ||
--FILE-- | ||
<?php | ||
|
||
/* ldap_add(_ext)(), ldap_mod_replace(_ext)(), ldap_mod_add(_ext)(), and ldap_mod_del(_ext)() share an underlying C function */ | ||
/* We are assuming 3333 is not connectable */ | ||
$ldap = ldap_connect('ldap://127.0.0.1:3333'); | ||
$valid_dn = "cn=userA,something"; | ||
|
||
$dict_key_multi_value_not_list_of_strings2 = [ | ||
'attribute1' => 'value', | ||
'attribute2' => [ | ||
'value1', | ||
new stdClass(), | ||
], | ||
]; | ||
try { | ||
var_dump(ldap_add($ldap, $valid_dn, $dict_key_multi_value_not_list_of_strings2)); | ||
} catch (Throwable $e) { | ||
echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
Error: Object of class stdClass could not be converted to string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
Bug GH-16136: Memory leak in php_ldap_do_modify() when entry is not a proper dictionary | ||
--EXTENSIONS-- | ||
ldap | ||
--FILE-- | ||
<?php | ||
|
||
/* ldap_add(_ext)(), ldap_mod_replace(_ext)(), ldap_mod_add(_ext)(), and ldap_mod_del(_ext)() share an underlying C function */ | ||
/* We are assuming 3333 is not connectable */ | ||
$ldap = ldap_connect('ldap://127.0.0.1:3333'); | ||
$valid_dn = "cn=userA,something"; | ||
|
||
$not_dict_of_attributes = [ | ||
'attribute1' => 'value', | ||
'not_key_entry', | ||
'attribute3' => [ | ||
'value1', | ||
'value2', | ||
], | ||
]; | ||
try { | ||
var_dump(ldap_add($ldap, $valid_dn, $not_dict_of_attributes)); | ||
} catch (Throwable $e) { | ||
echo $e::class, ': ', $e->getMessage(), PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
Warning: ldap_add(): Unknown attribute in the data in %s on line %d | ||
bool(false) |