Skip to content

Fix for sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE #2249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ext/mysqlnd/mysqlnd_wireprotocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,12 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
zero-length byte, don't read the body, there is no such.
*/

*data_size = 0;
/*
We're allocating an extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
needs to be able to append a terminating \0 for atoi/atof.
*/
*data_size = 1;

while (1) {
if (FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info)) {
ret = FAIL;
Expand Down Expand Up @@ -1526,6 +1531,7 @@ php_mysqlnd_read_row_ex(MYSQLND_PFC * pfc,
pool->free_chunk(pool, *buffer);
*buffer = NULL;
}
*data_size--;
DBG_RETURN(ret);
}
/* }}} */
Expand Down