[php-src] PR #26004: Fix GH-26003: Use-after-free when a key element's __toString() closes the DBA connection
| From: | thunderer | Date: | Tue, 01 Dec 2026 19:55:43 +0000 |
| Subject: | [php-src] PR #26004: Fix GH-26003: Use-after-free when a key element's __toString() closes the DBA connection | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41333@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/26004
Author: thunderer
Fixes GH-26003.
dba_insert(), dba_replace(), dba_exists(),
dba_fetch() and dba_delete() read the connection's
dba_info before php_dba_make_key() converts an array key, and that
conversion can call __toString(). If __toString() calls
dba_close(), the dba_info is freed. php_dba_make_key() now
checks the connection after the conversion and throws the same Error as for a closed
connection. The connection's info is only set on open and cleared on close, so if
it is still set, the caller's pointer is still valid.