Skip to content

Fix for sporadic segfault with MYSQLI_OPT_INT_AND_FLOAT_NATIVE #2250

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
10 changes: 8 additions & 2 deletions ext/mysqlnd/mysqlnd_wireprotocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,15 +1443,21 @@ php_mysqlnd_read_row_ex(MYSQLND_CONN_DATA * conn, MYSQLND_MEMORY_POOL * result_s
zend_bool first_iteration = TRUE;

DBG_ENTER("php_mysqlnd_read_row_ex");


/*
* We're allocating 1 extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
* needs to be able to add a terminating \0 for atoi/atof.
*/
prealloc_more_bytes++;

/*
To ease the process the server splits everything in packets up to 2^24 - 1.
Even in the case the payload is evenly divisible by this value, the last
packet will be empty, namely 0 bytes. Thus, we can read every packet and ask
for next one if they have 2^24 - 1 sizes. But just read the header of a
zero-length byte, don't read the body, there is no such.
*/

*data_size = prealloc_more_bytes;
while (1) {
if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info)) {
Expand Down