[php-src] PR #14849: Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c
| From: | nielsdos | Date: | Sat, 06 Jul 2024 20:48:22 +0000 |
| Subject: | [php-src] PR #14849: Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-27090@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14849
Author: nielsdos
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.