Fix a NULL pointer dereference of spl_ptr_llist_offset()#8272
Closed
zhou1615 wants to merge 1 commit intophp:PHP-8.0from
Closed
Fix a NULL pointer dereference of spl_ptr_llist_offset()#8272zhou1615 wants to merge 1 commit intophp:PHP-8.0from
zhou1615 wants to merge 1 commit intophp:PHP-8.0from
Conversation
cmb69
reviewed
Mar 29, 2022
3276e8d to
4b95210
Compare
spl_ptr_llist_offset() will return NULL when offset is invalid. However in the function zim_SplDoublyLinkedList_add(), the return value of spl_ptr_llist_offset() is directly used without check, which could lead to possible NULL pointer dereference. Fix this bug by adding the check of spl_ptr_llist_offset() like others. This bug is found by a static analyzer, making it hard to reproduce.
4b95210 to
70d24d3
Compare
Member
|
Thank you! Since this is not bug (fix), I've applied the patch to master only. |
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.
spl_ptr_llist_offset() will return NULL when offset is invalid. However
in the function zim_SplDoublyLinkedList_add(), the return value of
spl_ptr_llist_offset() is directly used without check, which could
lead to possible NULL pointer dereference.
Fix this bug by adding the check of spl_ptr_llist_offset() like others.
This bug is found by a static analyzer, making it hard to reproduce.