[php-src] PR #25297: ext/mysqlnd: Fix crash after metadata EOF failure on prepared statements
| From: | iliaal | Date: | Sat, 07 Nov 2026 20:35:35 +0000 |
| Subject: | [php-src] PR #25297: ext/mysqlnd: Fix crash after metadata EOF failure on prepared statements | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40415@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25297
Author: iliaal
If the server sends a short EOF packet after a prepared statement's column definitions, or
closes the connection there,
mysqli_stmt::prepare() after stmt_init(),
mysqli_stmt::execute(), and PDOStatement::execute() crash:
mysqlnd_stmt_prepare_read_eof() and mysqlnd_query_read_result_set_header()
memset the whole statement on that failure, so the next errno or error access dereferences NULL.
Free only the result instead and report the failure, as CR_MALFORMED_PACKET for a short EOF and as
the connection error copied to the statement for a failed prepare. A failed execute still leaves the
connection in CONN_FETCHING_DATA and the statement open on the server, as it did before this change.