Skip to content

Fix a NULL pointer dereference of spl_ptr_llist_offset()#8272

Closed
zhou1615 wants to merge 1 commit intophp:PHP-8.0from
zhou1615:spl_ptr_llist_offset
Closed

Fix a NULL pointer dereference of spl_ptr_llist_offset()#8272
zhou1615 wants to merge 1 commit intophp:PHP-8.0from
zhou1615:spl_ptr_llist_offset

Conversation

@zhou1615
Copy link
Contributor

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.

@zhou1615 zhou1615 force-pushed the spl_ptr_llist_offset branch from 3276e8d to 4b95210 Compare March 30, 2022 01:56
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.
@zhou1615 zhou1615 force-pushed the spl_ptr_llist_offset branch from 4b95210 to 70d24d3 Compare March 30, 2022 01:57
@cmb69 cmb69 closed this in 48e0707 Mar 30, 2022
@cmb69
Copy link
Member

cmb69 commented Mar 30, 2022

Thank you! Since this is not bug (fix), I've applied the patch to master only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants