com php-src: Merge branch 'PHP-5.6': Zend/zend_alloc.c ex t/ftp/ftp.c ext/pcntl/pcntl.c ext/phar/tar.c ext/st andard/basic_functions.c
ext/standard/dir.c ext/stand ard/file.c ext/standard/pack.c main/rfc1867.c
| From: | Stanislav Malyshev | Date: | Tue, 12 May 2015 22:00:24 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': Zend/zend_alloc.c ex t/ftp/ftp.c ext/pcntl/pcntl.c ext/phar/tar.c ext/st andard/basic_functions.c ext/standard/dir.c ext/stand ard/file.c ext/standard/pack.c main/rfc1867.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86712@lists.php.net to get a copy of this message | ||
Commit: 5a1bef8eef07881f8620c4521fcd108e75e4728d
Author: Stanislav Malyshev <stas@php.net> Tue, 12 May 2015 14:31:52 -0700
Parents: 468e37fe027259fd0a61ac3a84cac1336f768005 587ddf6ddccd707d67d48dccd4f4ca0a90224ac9
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5a1bef8eef07881f8620c4521fcd108e75e4728d
Log:
Merge branch 'PHP-5.6'
* PHP-5.6:
fix format
update NEWS
Add test for bug #69522
Update tests
Fix bug #69522 - do not allow int overflow
Forgot test file
Fix bug #69403 and other int overflows
Fixed bug #69418 - more s->p fixes for filenames
Fixed bug #69364 - use smart_str to assemble strings
Fix bug #69453 - don't try to cut empty string
Fix bug #69545 - avoid overflow when reading list
Conflicts:
Zend/zend_alloc.c
Zend/zend_operators.c
ext/ftp/ftp.c
ext/pcntl/pcntl.c
ext/standard/basic_functions.c
ext/standard/dir.c
ext/standard/file.c
ext/standard/pack.c
ext/standard/string.c
main/rfc1867.c
Bugs:
https://bugs.php.net/69522
https://bugs.php.net/69403
https://bugs.php.net/69418
https://bugs..php.net/69364
https://bugs.php.net/69453
https://bugs.php.net/69545
Changed paths:
MM Zend/zend_alloc.c
MM ext/ftp/ftp.c
MM ext/pcntl/pcntl.c
MM ext/phar/tar.c
MM ext/standard/basic_functions.c
MM ext/standard/dir.c
MM ext/standard/file.c
MM ext/standard/pack.c
MM main/rfc1867.c
Diff:
diff --cc ext/pcntl/pcntl.c
index 4842e1a,975b7f8..7e75139
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@@ -778,12 -748,14 +778,12 @@@ PHP_FUNCTION(pcntl_exec
char **argv = NULL, **envp = NULL;
char **current_arg, **pair;
int pair_length;
- char *key;
- uint key_length;
+ zend_string *key;
char *path;
- int path_len;
- ulong key_num;
+ size_t path_len;
+ zend_ulong key_num;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|aa", &path, &path_len, &args,
&envs) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|aa", &path, &path_len,
&args, &envs) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|aa", &path, &path_len, &args,
&envs) == FAILURE) {
return;
}
diff --cc ext/standard/basic_functions.c
index 5e23fe2,9b13b3a..50dcab7
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@@ -5405,11 -5463,11 +5405,11 @@@ PHP_FUNCTION(ini_restore
Sets the include_path configuration option */
PHP_FUNCTION(set_include_path)
{
- char *new_value;
- int new_value_len;
+ zend_string *new_value;
char *old_value;
+ zend_string *key;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &new_value) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &new_value,
&new_value_len) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &new_value) == FAILURE) {
return;
}
diff --cc ext/standard/dir.c
index b1d211a,dc3b4ca..463cfa9
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@@ -224,7 -219,7 +224,7 @@@ static void _php_do_opendir(INTERNAL_FU
php_stream_context *context = NULL;
php_stream *dirp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &dirname, &dir_len,
&zcontext) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dirname, &dir_len,
&zcontext) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &dirname, &dir_len,
&zcontext) == FAILURE) {
RETURN_NULL();
}
@@@ -297,10 -292,9 +297,10 @@@ PHP_FUNCTION(closedir
PHP_FUNCTION(chroot)
{
char *str;
- int ret, str_len;
+ int ret;
+ size_t str_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &str, &str_len) ==
FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &str, &str_len) == FAILURE) {
RETURN_FALSE;
}
diff --cc ext/standard/file.c
index fa9e752,02ab492..7aa1ce7
--- a/ext/standard/file..c
+++ b/ext/standard/file.c
@@@ -801,12 -816,13 +801,12 @@@ parse_eol
PHP_FUNCTION(tempnam)
{
char *dir, *prefix;
- int dir_len, prefix_len;
- size_t p_len;
- char *opened_path;
- char *p;
+ size_t dir_len, prefix_len;
+ zend_string *opened_path;
int fd;
+ zend_string *p;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &dir, &dir_len, &prefix,
&prefix_len) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &dir, &dir_len,
&prefix, &prefix_len) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &dir, &dir_len, &prefix,
&prefix_len) == FAILURE) {
return;
}
@@@ -1353,7 -1347,7 +1353,7 @@@ PHP_FUNCTION(rmdir
zval *zcontext = NULL;
php_stream_context *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &dir, &dir_len,
&zcontext) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|r", &dir, &dir_len,
&zcontext) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|r", &dir, &dir_len,
&zcontext) == FAILURE) {
RETURN_FALSE;
}
diff --cc ext/standard/pack.c
index 5fc1388,457392b..4327c7d
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@@ -713,8 -736,9 +719,9 @@@ PHP_FUNCTION(unpack
}
if (size != 0 && size != -1 && INT_MAX - size + 1 < inputpos) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Type %c: integer overflow", type);
+ php_error_docref(NULL, E_WARNING, "Type %c: integer overflow", type);
- inputpos = 0;
+ zval_dtor(return_value);
+ RETURN_FALSE;
}
if ((inputpos + size) <= inputlen) {
diff --cc main/rfc1867.c
index 8425ece,ca8f28b..3c1bfa6
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@@ -33,6 -33,7 +33,7 @@@
#include "php_variables.h"
#include "rfc1867.h"
#include "ext/standard/php_string.h"
-#include "ext/standard/php_smart_str.h"
++#include "ext/standard/php_smart_string.h"
#if defined(PHP_WIN32) && !defined(HAVE_ATOLL)
# define atoll(s) _atoi64(s)
@@@ -405,27 -401,27 +406,27 @@@ static int find_boundary(multipart_buff
}
/* parse headers */
-static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC)
+static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header)
{
char *line;
- mime_header_entry prev_entry = {0}, entry;
- int prev_len, cur_len;
+ mime_header_entry entry = {0};
- smart_str buf_value = {0};
++ smart_string buf_value = {0};
+ char *key = NULL;
/* didn't find boundary, abort */
- if (!find_boundary(self, self->boundary TSRMLS_CC)) {
+ if (!find_boundary(self, self->boundary)) {
return 0;
}
/* get lines of text, or CRLF_CRLF */
- while( (line = get_line(self TSRMLS_CC)) && line[0] != '\0' )
+ while( (line = get_line(self)) && line[0] != '\0' )
{
/* add header to table */
- char *key = line;
char *value = NULL;
- if (php_rfc1867_encoding_translation(TSRMLS_C)) {
- self->input_encoding = zend_multibyte_encoding_detector((unsigned char *)line, strlen(line),
self->detect_order, self->detect_order_size TSRMLS_CC);
+ if (php_rfc1867_encoding_translation()) {
+ self->input_encoding = zend_multibyte_encoding_detector((const unsigned char *) line,
strlen(line), self->detect_order, self->detect_order_size);
}
/* space in the beginning means same header */
@@@ -434,31 -430,33 +435,34 @@@
}
if (value) {
- *value = 0;
+ if(buf_value.c && key) {
+ /* new entry, add the old one to the list */
- smart_str_0(&buf_value);
++ smart_string_0(&buf_value);
+ entry.key = key;
+ entry.value = buf_value.c;
+ zend_llist_add_element(header, &entry);
+ buf_value.c = NULL;
+ key = NULL;
+ }
+
+ *value = '\0';
do { value++; } while(isspace(*value));
- entry.value = estrdup(value);
- entry.key = estrdup(key);
-
- } else if (zend_llist_count(header)) { /* If no ':' on the line, add to previous line
*/
-
- prev_len = (int)strlen(prev_entry.value);
- cur_len = (int)strlen(line);
-
- entry.value = emalloc(prev_len + cur_len + 1);
- memcpy(entry.value, prev_entry.value, prev_len);
- memcpy(entry.value + prev_len, line, cur_len);
- entry.value[cur_len + prev_len] = '\0';
-
- entry.key = estrdup(prev_entry.key);
-
- zend_llist_remove_tail(header);
+ key = estrdup(line);
- smart_str_appends(&buf_value, value);
++ smart_string_appends(&buf_value, value);
+ } else if (buf_value.c) { /* If no ':' on the line, add to previous line */
- smart_str_appends(&buf_value, line);
++ smart_string_appends(&buf_value, line);
} else {
continue;
}
+ }
+
+ if(buf_value.c && key) {
+ /* add the last one to the list */
- smart_str_0(&buf_value);
++ smart_string_0(&buf_value);
+ entry.key = key;
+ entry.value = buf_value.c;
zend_llist_add_element(header, &entry);
- prev_entry = entry;
}
return 1;