Repository navigation
Conversation
Member
|
This fixes GH-25005. Please retarget the base to PHP-8.4 and rebase onto that branch. The unguarded retdata assignments are unchanged there. |
iliaal
self-requested a review
October 28, 2026 17:21
ldap_exop_sync() always takes the synchronous branch of php_ldap_exop(), which assigns $response_data unconditionally. When the argument is not passed, retdata is NULL and ZEND_TRY_ASSIGN_REF_STRINGL()/ ZEND_TRY_ASSIGN_REF_EMPTY_STRING() dereference it, so any successful ldap_exop_sync($ldap, $oid) call segfaults. Guard the assignment the way the $response_oid one already is.
lacatoire
force-pushed
the
fix/ldap-exop-sync-null-response-data
branch
from
October 29, 2026 10:58
fce4c8f to
1fd085c
Compare
iliaal
approved these changes
Oct 29, 2026
iliaal
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for rebasing to 8.4
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ldap_exop_sync()passesforce_sync = truetophp_ldap_exop(), so the block that writes back$response_datais always entered regardless of whether the argument was supplied. When it is omitted,retdataisNULL, and bothZEND_TRY_ASSIGN_REF_STRINGLandZEND_TRY_ASSIGN_REF_EMPTY_STRINGdereference it —ZEND_ASSERT(Z_ISREF_P(zv))in debug builds, a NULL dereference crash in release.ldap_exop()is not affected: thereretdata != NULLis what selects the branch in the first place.The fix mirrors the existing
if (retoid)guard a few lines above.ldap_memfree()is still called unconditionally so there is no memory leak.Reproduced on PHP 8.4.22 (exit code 139). Present since
ldap_exop_sync()was introduced in PHP 8.3.0.