History log of /php-src/ext/spl/tests/gh14639.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 0d4e0c01 06-Jul-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c

`spl_object_storage_attach_handle` creates an entry already, but only
fills it in at the end with `spl_object_st

Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c

`spl_object_storage_attach_handle` creates an entry already, but only
fills it in at the end with `spl_object_storage_create_element` which
allocates memory. In this case the allocation fails and we're left with
a NULL slot. Doing the allocation first isn't an option because we want
to check whether the slot is occupied before allocating memory.
The simplest solution is to set the entry to NULL and check for a NULL
pointer upon destruction.

Closes GH-14849.

show more ...