Skip to content

Commit

Permalink
spl_ptr_llist_offset() is not supposed to return NULL here
Browse files Browse the repository at this point in the history
This issue has found by a static analyzer.

Closes GH-8272.
  • Loading branch information
zhou1615 authored and cmb69 committed Mar 30, 2022
1 parent c9c5ee3 commit 48e0707
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ext/spl/spl_dllist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ PHP_METHOD(SplDoublyLinkedList, add)

/* Get the element we want to insert before */
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
ZEND_ASSERT(element != NULL);

ZVAL_COPY(&elem->data, value);
SPL_LLIST_RC(elem) = 1;
Expand Down

0 comments on commit 48e0707

Please sign in to comment.