Skip to content

Commit 732f67e

Browse files
vanviegenkrakjoe
authored andcommitted
Fix for sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE
Fixes bug #73800 news entry for PR #2250
1 parent 9f4d05a commit 732f67e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ PHP NEWS
2020
- Mysqlnd:
2121
. Fixed issue with decoding BIT columns when having more than one rows in the
2222
result set. 7.0+ problem. (Andrey)
23+
. Fixed bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE).
24+
(vanviegen)
2325

2426
- PCRE:
2527
. Fixed bug #73612 (preg_*() may leak memory). (cmb)

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,15 +1443,21 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
14431443
zend_bool first_iteration = TRUE;
14441444

14451445
DBG_ENTER("php_mysqlnd_read_row_ex");
1446-
1446+
1447+
/*
1448+
* We're allocating 1 extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
1449+
* needs to be able to add a terminating \0 for atoi/atof.
1450+
*/
1451+
prealloc_more_bytes++;
1452+
14471453
/*
14481454
To ease the process the server splits everything in packets up to 2^24 - 1.
14491455
Even in the case the payload is evenly divisible by this value, the last
14501456
packet will be empty, namely 0 bytes. Thus, we can read every packet and ask
14511457
for next one if they have 2^24 - 1 sizes. But just read the header of a
14521458
zero-length byte, don't read the body, there is no such.
14531459
*/
1454-
1460+
14551461
*data_size = prealloc_more_bytes;
14561462
while (1) {
14571463
if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info)) {

0 commit comments

Comments
 (0)