summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
diff options
context:
space:
mode:
authorandrewnester <andrew.nester.dev@gmail.com>2017-02-01 13:43:55 +0300
committerNikita Popov <nikita.ppv@gmail.com>2017-02-12 12:48:18 +0100
commit01c1afa79f614fe8376e73f4e73f392160923745 (patch)
tree686421d9708fae37d16b446962edf24e48297515 /ext/mysqlnd
parentee25eb0eae52a942c914b997c14d9558be76ee88 (diff)
downloadphp-git-01c1afa79f614fe8376e73f4e73f392160923745.tar.gz
Fixed bug #74021
Diffstat (limited to 'ext/mysqlnd')
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 2620f3bc78..6113543e2b 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1458,7 +1458,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
zero-length byte, don't read the body, there is no such.
*/
- *data_size = prealloc_more_bytes;
+ *data_size = 0;
while (1) {
if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info)) {
ret = FAIL;
@@ -1469,7 +1469,8 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
if (first_iteration) {
first_iteration = FALSE;
- *buffer = result_set_memory_pool->get_chunk(result_set_memory_pool, *data_size);
+ *buffer = result_set_memory_pool->get_chunk(
+ result_set_memory_pool, *data_size + prealloc_more_bytes);
if (!*buffer) {
ret = FAIL;
break;
@@ -1484,7 +1485,7 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
/*
We have to realloc the buffer.
*/
- if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size)) {
+ if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size + prealloc_more_bytes)) {
SET_OOM_ERROR(*conn->error_info);
ret = FAIL;
break;
@@ -1507,7 +1508,6 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
(*buffer)->free_chunk((*buffer));
*buffer = NULL;
}
- *data_size -= prealloc_more_bytes;
DBG_RETURN(ret);
}
/* }}} */