diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2017-02-25 12:55:14 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-02-25 12:55:14 +0100 |
commit | bbfa1b64192fe3ccd2898e6e1f997387b4f210d1 (patch) | |
tree | dd318f1f1a29559f420ebc6d4c00135690769203 | |
parent | eac8166bd468a3c7c00b5163f6f86804911b660d (diff) | |
download | php-git-bbfa1b64192fe3ccd2898e6e1f997387b4f210d1.tar.gz |
Improve fix for bug #73807
At least on some architectures memmove() on FreeBSD does not
short-curcuit if src==dst. Check for it explicitly to avoid
quadratic copying.
-rw-r--r-- | main/php_variables.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index aa6e426ba3..d3cfb7f737 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -311,7 +311,7 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof) } } - if (!eof) { + if (!eof && ZSTR_VAL(vars->str.s) != vars->ptr) { memmove(ZSTR_VAL(vars->str.s), vars->ptr, ZSTR_LEN(vars->str.s) = vars->end - vars->ptr); } return SUCCESS; |