Skip to content

Commit abba56f

Browse files
vanviegenkrakjoe
authored andcommitted
Fix for sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE
Fixes bug #73800 news entry for PR #2249
1 parent 156781b commit abba56f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ PHP NEWS
3131
- Mysqlnd:
3232
. Optimized handling of BIT fields - less memory copies and lower memory
3333
usage. (Andrey)
34+
. Fixed bug #73800 (sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE).
35+
(vanviegen)
3436

3537
- Opcache:
3638
. Fixed bug #73789 (Strange behavior of class constants in switch/case block).

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,12 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
14771477
zero-length byte, don't read the body, there is no such.
14781478
*/
14791479

1480-
*data_size = 0;
1480+
/*
1481+
We're allocating an extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
1482+
needs to be able to append a terminating \0 for atoi/atof.
1483+
*/
1484+
*data_size = 1;
1485+
14811486
while (1) {
14821487
if (FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info)) {
14831488
ret = FAIL;
@@ -1526,6 +1531,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
15261531
pool->free_chunk(pool, *buffer);
15271532
*buffer = NULL;
15281533
}
1534+
*data_size--;
15291535
DBG_RETURN(ret);
15301536
}
15311537
/* }}} */

0 commit comments

Comments
 (0)