com php-src: Fixed segfault of stream handling: ext/mysqlnd/mysqlnd.c ext/mysqlnd/mysqlnd_net.c ext/mysqlnd/mysqlnd_result. c
ext/mysqlnd/mysqlnd_wireprotocol.c
| From: | Xinchen Hui | Date: | Wed, 18 Jun 2014 07:03:01 +0000 |
| Subject: | com php-src: Fixed segfault of stream handling: ext/mysqlnd/mysqlnd.c ext/mysqlnd/mysqlnd_net.c ext/mysqlnd/mysqlnd_result. c ext/mysqlnd/mysqlnd_wireprotocol.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78944@lists.php.net to get a copy of this message | ||
Commit: 83d450c78de128da32048ef369d9769fa73be9da
Author: Xinchen Hui <laruence@php.net> Wed, 18 Jun 2014 14:42:46 +0800
Parents: 4c4dc8e2395598c6c1a3231ff9770dc1a8e381ea
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=83d450c78de128da32048ef369d9769fa73be9da
Log:
Fixed segfault of stream handling
Changed paths:
M ext/mysqlnd/mysqlnd.c
M ext/mysqlnd/mysqlnd_net.c
M ext/mysqlnd/mysqlnd_result.c
M ext/mysqlnd/mysqlnd_wireprotocol.c
Diff:
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index c5db05b..acd1615 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -998,7 +998,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
SET_OOM_ERROR(*conn->error_info);
goto err; /* OOM */
}
- conn->host_info = mnd_pestrdup(p, conn->persistent);
+ conn->host_info = mnd_pestrdup(p, conn->persistent);
mnd_sprintf_free(p);
if (!conn->host_info) {
SET_OOM_ERROR(*conn->error_info);
diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c
index 4ec9aa4..6ca44cc 100644
--- a/ext/mysqlnd/mysqlnd_net.c
+++ b/ext/mysqlnd/mysqlnd_net.c
@@ -200,7 +200,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha
*/
zend_resource *le;
- if ((le = zend_hash_str_find(&EG(persistent_list), hashed_details, hashed_details_len))) {
+ if ((le = zend_hash_str_find_ptr(&EG(persistent_list), hashed_details, hashed_details_len)))
{
/*
in_free will let streams code skip destructing - big HACK,
but STREAMS suck big time regarding persistent streams.
@@ -223,7 +223,7 @@ MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const cha
unregistered yntil the script ends. So, we need to take care of that.
*/
net_stream->in_free = 1;
- zend_hash_index_del(&EG(regular_list), net_stream->res->handle); /* ToDO: should it be
res->handle, do streams register with addref ?*/
+ //????zend_hash_index_del(&EG(regular_list), net_stream->res->handle); /* ToDO: should
it be res->handle, do streams register with addref ?*/
net_stream->in_free = 0;
DBG_RETURN(net_stream);
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index a8ae8be..26551ec 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -1800,7 +1800,6 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned
int
Hint Zend how many elements we will have in the hash. Thus it won't
extend and rehash the hash constantly.
*/
- ZVAL_NEW_ARR(return_value);
array_init_size(return_value, mysqlnd_num_fields(result) * 2);
if (FAIL == result->m.fetch_row(result, (void *)return_value, flags, &fetched_anything
TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading a row");
@@ -1868,7 +1867,6 @@ MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, const unsigned
int
}
/* 4 is a magic value. The cast is safe, if larger then the array will be later extended - no big
deal :) */
- ZVAL_NEW_ARR(return_value);
array_init_size(return_value, set? (unsigned int) set->row_count : 4);
do {
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index e823705..2eeebee 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1760,24 +1760,30 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_MEMORY_POOL_CHUNK *
row_buffer,
bit_area += 1 + sprintf((char *)start, "%ld", Z_LVAL_P(current_field));
//???? ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1, copy_data);
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
+ /*
if (!copy_data) {
efree(start);
}
+ */
} else if (Z_TYPE_P(current_field) == IS_STRING){
memcpy(bit_area, Z_STRVAL_P(current_field), Z_STRLEN_P(current_field));
bit_area += Z_STRLEN_P(current_field);
*bit_area++ = '\0';
zval_dtor(current_field);
ZVAL_STRINGL(current_field, (char *) start, bit_area - start - 1);
+ /*
if (!copy_data) {
efree(start);
}
+ */
}
} else {
ZVAL_STRINGL(current_field, (char *)p, len);
+ /*
if (!copy_data) {
efree(p);
}
+ */
}
p += len;
last_field_was_string = TRUE;