From 9552cf6b84b73de38c152b97cc8d30ac3509d4a5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 16 Feb 2021 15:26:31 +0100 Subject: Handle incomplete result set metadata more gracefully Rather than segfaulting because sname is missing lateron, report a FAIL here. As this indicates a server bug, the errors is reported as an out of band warning, rather than a client error. This fixes the PHP side of bug #80713. --- NEWS | 3 +++ ext/mysqlnd/mysqlnd_wireprotocol.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fd18d5859c..3d4f1c5d87 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2021, php 7.4.17 +- MySQLnd: + . Fixed bug #80713 (SegFault when disabling ATTR_EMULATE_PREPARES and + MySQL 8.0). (Nikita) 04 Mar 2021, php 7.4.16 diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 072fdde97a..87b2e7c313 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1216,8 +1216,9 @@ php_mysqlnd_rset_field_read(MYSQLND_CONN_DATA * conn, void * _packet) DBG_RETURN(PASS); } else if (EODATA_MARKER == *p && packet->header.size < 8) { /* Premature EOF. That should be COM_FIELD_LIST. But we don't support COM_FIELD_LIST anymore, thus this should not happen */ - DBG_INF("Premature EOF. That should be COM_FIELD_LIST"); - DBG_RETURN(PASS); + DBG_ERR("Premature EOF. That should be COM_FIELD_LIST"); + php_error_docref(NULL, E_WARNING, "Premature EOF in result field metadata"); + DBG_RETURN(FAIL); } meta = packet->metadata; -- cgit v1.2.1