]> granicus.if.org Git - php/commitdiff
fix bad pointer cast in ext/phar, fix segfault and failed tests (bigendian)
authorRemi Collet <remi@php.net>
Tue, 16 Dec 2014 08:31:20 +0000 (09:31 +0100)
committerRemi Collet <remi@php.net>
Tue, 16 Dec 2014 08:31:20 +0000 (09:31 +0100)
ext/phar/func_interceptors.c
ext/phar/phar_object.c [changed mode: 0644->0755]

index bd7324c78e16256bd3cde99038de3a40eafb24fa..fa303a3b22048e016bb2bcfbdb064483a92150cb 100644 (file)
@@ -339,7 +339,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
        }
        if (use_include_path || (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://"))) {
                char *arch, *entry, *fname;
-               size_t arch_len, entry_len, fname_len;
+               int arch_len, entry_len, fname_len;
                php_stream_context *context = NULL;
                char *name;
                phar_archive_data *phar;
@@ -349,7 +349,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
                        goto skip_phar;
                }
                fname_len = strlen(fname);
-               if (FAILURE == phar_split_fname(fname, fname_len, &arch, (int *)&arch_len, &entry, (int *)&entry_len, 2, 0 TSRMLS_CC)) {
+               if (FAILURE == phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0 TSRMLS_CC)) {
                        goto skip_phar;
                }
 
@@ -371,7 +371,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
                                name = entry;
                        }
                } else {
-                       entry = phar_fix_filepath(estrndup(entry, entry_len), (int *)&entry_len, 1 TSRMLS_CC);
+                       entry = phar_fix_filepath(estrndup(entry, entry_len), &entry_len, 1 TSRMLS_CC);
                        if (entry[0] == '/') {
                                if (!zend_hash_str_exists(&(phar->manifest), entry + 1, entry_len - 1)) {
                                        /* this file is not in the phar, use the original path */
old mode 100644 (file)
new mode 100755 (executable)
index d23c7cd..b6ce546
@@ -546,7 +546,8 @@ PHP_METHOD(Phar, webPhar)
 {
        zval *mimeoverride = NULL, *rewrite = NULL;
        char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL;
-       size_t alias_len = 0, f404_len = 0, free_pathinfo = 0, ru_len = 0;
+       size_t alias_len = 0, f404_len = 0, free_pathinfo = 0;
+       int  ru_len = 0;
        char *fname, *path_info, *mime_type = NULL, *entry, *pt;
        const char *basename;
        size_t fname_len, index_php_len = 0;
@@ -729,7 +730,7 @@ PHP_METHOD(Phar, webPhar)
        }
 
        if (entry_len) {
-               phar_postprocess_ru_web(fname, fname_len, &entry, (int *)&entry_len, &ru, (int *)&ru_len TSRMLS_CC);
+               phar_postprocess_ru_web(fname, fname_len, &entry, &entry_len, &ru, &ru_len TSRMLS_CC);
        }
 
        if (!entry_len || (entry_len == 1 && entry[0] == '/')) {
@@ -1999,7 +2000,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
        zend_class_entry *ce;
        char *error;
        const char *pcr_error;
-       size_t ext_len = ext ? strlen(ext) : 0;
+       int ext_len = ext ? strlen(ext) : 0;
        int oldname_len;
        phar_archive_data *pphar = NULL;
        php_stream_statbuf ssb;
@@ -2050,7 +2051,7 @@ static zend_object *phar_rename_archive(phar_archive_data *phar, char *ext, zend
                                        ext = "phar";
                        }
                }
-       } else if (phar_path_check(&ext, (int *)&ext_len, &pcr_error) > pcr_is_ok) {
+       } else if (phar_path_check(&ext, &ext_len, &pcr_error) > pcr_is_ok) {
 
                if (phar->is_data) {
                        zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "data phar converted from \"%s\" has invalid extension %s", phar->fname, ext);