com php-src: Merge branch 'PHP-7.0' into PHP-7.1: ext/phar/phar _object.c
| From: | Stanislav Malyshev | Date: | Fri, 25 Nov 2016 23:32:59 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.0' into PHP-7.1: ext/phar/phar _object.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96044@lists.php.net to get a copy of this message | ||
Commit: f9a80a0a2922a585e8d11e36a318128050121bcd
Author: Stanislav Malyshev <stas@php.net> Fri, 25 Nov 2016 15:32:59 -0800
Parents: ffb65ba833a2d999dd2a0771ebd8aac672271a26 7010547c4ed3edf4c5f26726f901d5640b9de4b2
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9a80a0a2922a585e8d11e36a318128050121bcd
Log:
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Fix more size_t/int implicit conversions
Changed paths:
MM ext/phar/phar_object..c
Diff:
diff --cc ext/phar/phar_object.c
index 28ec8a3,fc31a7e...ca9a031
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@@ -1321,10 -1356,10 +1346,10 @@@ PHP_METHOD(Phar, unlinkArchive
}
zname = (char*)zend_get_executed_filename();
- zname_len = strlen(zname);
+ zname_len = (int)strlen(zname);
if (zname_len > 7 && !memcmp(zname, "phar://", 7) && SUCCESS ==
phar_split_fname(zname, zname_len, &arch, &arch_len, &entry, &entry_len, 2, 0)) {
- if (arch_len == fname_len && !memcmp(arch, fname, arch_len)) {
+ if ((size_t)arch_len == fname_len && !memcmp(arch, fname, arch_len)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" cannot be
unlinked from within itself", fname);
efree(arch);
efree(entry);
@@@ -2664,7 -2743,10 +2716,10 @@@ PHP_METHOD(Phar, setAlias
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS)
{
+ if (ZEND_SIZE_T_INT_OVFL(alias_len)) {
+ RETURN_FALSE;
+ }
- if (alias_len == phar_obj->archive->alias_len &&
memcmp(phar_obj->archive->alias, alias, alias_len) == 0) {
+ if (alias_len == (size_t)phar_obj->archive->alias_len &&
memcmp(phar_obj->archive->alias, alias, alias_len) == 0) {
RETURN_TRUE;
}
if (alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)),
alias, alias_len))) {
@@@ -3776,7 -3880,17 +3853,10 @@@ PHP_METHOD(Phar, addFile
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &fname, &fname_len,
&localname, &localname_len) == FAILURE) {
return;
}
+ if (ZEND_SIZE_T_INT_OVFL(fname_len)) {
+ RETURN_FALSE;
+ }
-#if PHP_API_VERSION < 20100412
- if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file
\"%s\" to add to phar archive, safe_mode restrictions prevent this", fname);
- return;
- }
-#endif
-
if (!strstr(fname, "://") && php_check_open_basedir(fname)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file
\"%s\" to add to phar archive, open_basedir restrictions prevent this", fname);
return;