]> granicus.if.org Git - php/commitdiff
Merge branch 'master' into phpng
authorDmitry Stogov <dmitry@zend.com>
Tue, 13 May 2014 11:24:40 +0000 (15:24 +0400)
committerDmitry Stogov <dmitry@zend.com>
Tue, 13 May 2014 11:24:40 +0000 (15:24 +0400)
* master: (41 commits)
  fix test - output can be chunked
  fix test
  fix test
  Fixed test for commit 997be125eb0228c5b1b6dd278f617791e71192c6
  Add bug fix to NEWS
  Update UPGRADING according to bug fix
  fix test
  improve CURL tests to allow testing without separate server
  improve CURL tests to allow testing without separate server
  Fixed bug #67199 mb_regex_encoding mishmash
  Fix bug #67248 (imageaffinematrixget missing check of parameters)
  Fix bug #67247 spl_fixedarray_resize integer overflow
  fix news
  add tests stuff to README
  Updated NEWS
  Fix Linux specific fail in error traces (cherry-picked and fix for bug #67245) Linux apparently does not like memcpy in overlapping regions...
  - Fixed off-by-one in phar_build (patch by crrodriguez at opensuse dot org)
  - Move checking
  - Fixed missing NULL check in SimpleXMLElement::xpath()
  - Fixed missing NULL check
  ...

Conflicts:
ext/bz2/bz2.c
ext/gd/gd.c
ext/mbstring/php_mbregex.c
ext/session/tests/031.phpt
ext/simplexml/simplexml.c
ext/spl/spl_fixedarray.c

1  2 
ext/bz2/bz2.c
ext/gd/gd.c
ext/mbstring/php_mbregex.c
ext/mysqli/mysqli_priv.h
ext/phar/phar_object.c
ext/session/session.c
ext/simplexml/simplexml.c
ext/spl/spl_fixedarray.c
ext/standard/streamsfuncs.c
main/SAPI.c

diff --cc ext/bz2/bz2.c
index 8431b5214b51b0737d1404b46abe6a84c5299d2f,f310289d73ecaae1b26455d2ed71a5ad4bb10327..bd4ac68d1d6ea8546239738f34ca71a6eff58f41
@@@ -226,10 -226,13 +226,13 @@@ PHP_BZ2_API php_stream *_php_stream_bz2
  #ifdef VIRTUAL_DIR
        virtual_filepath_ex(path, &path_copy, NULL TSRMLS_CC);
  #else
-       path_copy = estrdup(path);
+       path_copy = path;
 -#endif  
 +#endif
  
        if (php_check_open_basedir(path_copy TSRMLS_CC)) {
+ #ifdef VIRTUAL_DIR
+               efree(path_copy);
+ #endif
                return NULL;
        }
        
        bz_file = BZ2_bzopen(path_copy, mode);
  
        if (opened_path && bz_file) {
-               *opened_path = estrdup(path_copy);
++#ifdef VIRTUAL_DIR
++              *opened_path = path_copy;
 +              path_copy = NULL;
++#else
+               *opened_path = estrdup(path_copy);
++#endif
        }
 -      efree(path_copy);
 +
+ #ifdef VIRTUAL_DIR
 +      if (path_copy) {
 +              efree(path_copy);
 +      }
+ #endif
+       path_copy = NULL;
        
        if (bz_file == NULL) {
                /* that didn't work, so try and get something from the network/wrapper */
diff --cc ext/gd/gd.c
index 54cf68edce1b95c9435b682bfac072b82107018a,f67e80bf8e641438e7e6671472198c9cdfab84b9..d7994476f0d0051ed94a26dfbfa69b04e3268d14
@@@ -5251,8 -5274,8 +5251,8 @@@ PHP_FUNCTION(imageaffinematrixget
  {
        double affine[6];
        long type;
-       zval *options;
+       zval *options = NULL;
 -      zval **tmp;
 +      zval *tmp;
        int res = GD_FALSE, i;
  
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|z", &type, &options) == FAILURE)  {
                case GD_AFFINE_SHEAR_VERTICAL: {
                        double angle;
  
 -                      convert_to_double_ex(&options);
+                       if (!options) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number is expected as option");
+                               RETURN_FALSE;
+                       }
 +                      convert_to_double_ex(options);
                        angle = Z_DVAL_P(options);
  
                        if (type == GD_AFFINE_SHEAR_HORIZONTAL) {
index c0e61aa660293d91cd525fecc47a96dbf9ddb5a9,9ea297039343df77b9f9f2832e0a45c53743cabb..24c1ff901977c1e2eef3dec04ee8abc705098791
@@@ -63,10 -64,10 +63,10 @@@ static void php_mb_regex_free_cache(zva
  /* {{{ _php_mb_regex_globals_ctor */
  static int _php_mb_regex_globals_ctor(zend_mb_regex_globals *pglobals TSRMLS_DC)
  {
-       pglobals->default_mbctype = ONIG_ENCODING_EUC_JP;
-       pglobals->current_mbctype = ONIG_ENCODING_EUC_JP;
+       pglobals->default_mbctype = ONIG_ENCODING_UTF8;
+       pglobals->current_mbctype = ONIG_ENCODING_UTF8;
 -      zend_hash_init(&(pglobals->ht_rc), 0, NULL, (void (*)(void *)) php_mb_regex_free_cache, 1);
 -      pglobals->search_str = (zval*) NULL;
 +      zend_hash_init(&(pglobals->ht_rc), 0, NULL, php_mb_regex_free_cache, 1);
 +      ZVAL_UNDEF(&pglobals->search_str);
        pglobals->search_re = (php_mb_regex_t*)NULL;
        pglobals->search_pos = 0;
        pglobals->search_regs = (OnigRegion*)NULL;
Simple merge
index 978b036c6752cd48e50475fd08ee599f799282e3,75aadfbc540b9929b0af563e365990c69b1ca315..d73f6ad6419095c350c090d22ee7d5ab4fdd9a5b
@@@ -1469,16 -1477,16 +1469,16 @@@ static int phar_build(zend_object_itera
                        }
  
                        close_fp = 0;
-                       opened = (char *) estrndup(str, sizeof("[stream]") + 1);
+                       opened = (char *) estrndup(str, sizeof("[stream]") - 1);
                        goto after_open_fp;
                case IS_OBJECT:
 -                      if (instanceof_function(Z_OBJCE_PP(value), spl_ce_SplFileInfo TSRMLS_CC)) {
 +                      if (instanceof_function(Z_OBJCE_P(value), spl_ce_SplFileInfo TSRMLS_CC)) {
                                char *test = NULL;
                                zval dummy;
 -                              spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(*value TSRMLS_CC);
 +                              spl_filesystem_object *intern = (spl_filesystem_object*)((char*)Z_OBJ_P(value) - Z_OBJ_P(value)->handlers->offset);
  
                                if (!base_len) {
 -                                      zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name);
 +                                      zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ce->name->val);
                                        return ZEND_HASH_APPLY_STOP;
                                }
  
index a21262c17d25f3061f3220c402d3b1742620c559,8051758c121683a614baf5c639983c95c019ed87..c39e954ded24bb1ca2c05ec87971785f1bc7ccc6
@@@ -1572,10 -1603,10 +1572,10 @@@ PHPAPI void php_session_start(TSRMLS_D
                }
        }
  
-       /* Finally check session id for dangarous characters
+       /* Finally check session id for dangerous characters
         * Security note: session id may be embedded in HTML pages.*/
 -      if (PS(id) && strpbrk(PS(id), "\r\n\t <>'\"\\")) {
 -              efree(PS(id));
 +      if (PS(id) && strpbrk(PS(id)->val, "\r\n\t <>'\"\\")) {
 +              STR_RELEASE(PS(id));
                PS(id) = NULL;
        }
  
index 099d9722bd48d8ac18d22e894504bb0df4af87c9,a915862ec47f9589309acc4996ca8f6179788746..f9f7452bf4893fe275dcb514b3385bc06fbe3d7c
@@@ -1512,9 -1536,7 +1515,7 @@@ SXE_METHOD(getDocNamespaces
                return;
        }
  
-       array_init(return_value);
 -      sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
 +      sxe = Z_SXEOBJ_P(getThis());
        if(from_root){
                node = xmlDocGetRootElement((xmlDocPtr)sxe->document->ptr);
        }else{
index 9983025165e8c05c941a95fcbb3d8f60de0b4121,2c5d5f626cdb75cbb2b252d904dc250d241222d7..6936845b321129f49c288bfea9530c3e4e69a954
@@@ -120,8 -116,8 +120,8 @@@ static void spl_fixedarray_resize(spl_f
                        array->elements = NULL;
                }
        } else if (size > array->size) {
-               array->elements = erealloc(array->elements, sizeof(zval) * size);
 -              array->elements = safe_erealloc(array->elements, size, sizeof(zval *), 0);
 -              memset(array->elements + array->size, '\0', sizeof(zval *) * (size - array->size));
++              array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0);
 +              memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size));
        } else { /* size < array->size */
                long i;
  
index 81afb2228e10c321fd5a18db2969af1e2fc878e9,68b4cceaaa352daa098803b1ec6abf5c5ff17cd4..1d59a97a94d90f128873609311ee88a3874e0b16
@@@ -40,6 -40,8 +40,8 @@@ typedef unsigned long long php_timeout_
  typedef unsigned __int64 php_timeout_ull;
  #endif
  
 -#define GET_CTX_OPT(stream, wrapper, name, val) (stream->context && SUCCESS == php_stream_context_get_option(stream->context, wrapper, name, &val))
++#define GET_CTX_OPT(stream, wrapper, name, val) (stream->context && NULL != (val = php_stream_context_get_option(stream->context, wrapper, name)))
  static php_stream_context *decode_context_param(zval *contextresource TSRMLS_DC);
  
  /* Streams based network functions */
@@@ -1451,11 -1500,22 +1453,22 @@@ PHP_FUNCTION(stream_socket_enable_crypt
                RETURN_FALSE;
        }
  
 -      php_stream_from_zval(stream, &zstream);
 +      php_stream_from_zval(stream, zstream);
  
-       if (ZEND_NUM_ARGS() >= 3) {
+       if (enable) {
+               if (ZEND_NUM_ARGS() < 3 || cryptokindnull) {
 -                      zval **val;
++                      zval *val;
+                       if (!GET_CTX_OPT(stream, "ssl", "crypto_method", val)) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "When enabling encryption you must specify the crypto type");
+                               RETURN_FALSE;
+                       }
 -                      cryptokind = Z_LVAL_PP(val);
++                      cryptokind = Z_LVAL_P(val);
+               }
                if (zsessstream) {
 -                      php_stream_from_zval(sessstream, &zsessstream);
 +                      php_stream_from_zval(sessstream, zsessstream);
                }
  
                if (php_stream_xport_crypto_setup(stream, cryptokind, sessstream TSRMLS_CC) < 0) {
diff --cc main/SAPI.c
Simple merge