]> granicus.if.org Git - php/commitdiff
ensure we don't try to use an unitialized hash table
authorGreg Beaver <cellog@php.net>
Thu, 12 Jun 2008 18:46:58 +0000 (18:46 +0000)
committerGreg Beaver <cellog@php.net>
Thu, 12 Jun 2008 18:46:58 +0000 (18:46 +0000)
ext/phar/func_interceptors.c

index 4813b571b42e07292e397d9d9947e7ee3f653dcb..709f3b0f751de3cdd651b7a00abec33bee1a54f4 100644 (file)
@@ -29,7 +29,7 @@ PHAR_FUNC(phar_opendir) /* {{{ */
        int filename_len;
        zval *zcontext = NULL;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                goto skip_phar;
        }
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &filename, &filename_len, &zcontext) == FAILURE) {
@@ -97,7 +97,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
        long maxlen = PHP_STREAM_COPY_ALL;
        zval *zcontext = NULL;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                goto skip_phar;
        }
        /* Parse arguments */
@@ -222,7 +222,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
        zval *zcontext = NULL;
        php_stream *stream;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                goto skip_phar;
        }
        if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
@@ -312,7 +312,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
        zval *zcontext = NULL;
        php_stream *stream;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                /* no need to check, include_path not even specified in fopen/ no active phars */
                goto skip_phar;
        }
@@ -869,7 +869,7 @@ PHAR_FUNC(phar_is_file) /* {{{ */
        char *filename;
        int filename_len;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                goto skip_phar;
        }
        if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
@@ -929,7 +929,7 @@ PHAR_FUNC(phar_is_link) /* {{{ */
        char *filename;
        int filename_len;
 
-       if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
+       if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
                goto skip_phar;
        }
        if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {