com php-src: More edge case fixes that may cause bug #78106: ext/opcache/ZendAccelerator.c
| From: | Dmitry Stogov | Date: | Fri, 14 Jun 2019 10:10:02 +0000 |
| Subject: | com php-src: More edge case fixes that may cause bug #78106: ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106784@lists.php.net to get a copy of this message | ||
Commit: 96a12578c13b5c37195b10526fcdc669b795644d
Author: Dmitry Stogov <dmitry@zend.com> Fri, 14 Jun 2019 13:10:02 +0300
Parents: 91a6cdbff5ebd1ca4db1d6e8c42d3265ce80ace4
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=96a12578c13b5c37195b10526fcdc669b795644d
Log:
More edge case fixes that may cause bug #78106
Bugs:
https://bugs.php.net/78106
Changed paths:
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 995d21d..9fa178d 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -439,7 +439,7 @@ static zend_always_inline zend_string *accel_find_interned_string(zend_string *s
if (!ZCG(counted)) {
if (!ZCG(accelerator_enabled) || accel_activate_add() == FAILURE) {
- return str;
+ return NULL;
}
ZCG(counted) = 1;
}
@@ -747,10 +747,9 @@ static void accel_use_shm_interned_strings(void)
if (ZCSG(interned_strings).saved_top == NULL) {
accel_copy_permanent_strings(accel_new_interned_string);
} else {
+ ZCG(counted) = 1;
accel_copy_permanent_strings(accel_replace_string_by_shm_permanent);
- if (ZCG(counted)) {
- accel_deactivate_sub();
- }
+ ZCG(counted) = 0;
}
accel_interned_strings_save_state();
@@ -1177,7 +1176,11 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int
*key_l
cwd_len = ZCG(cwd_key_len) = buf + sizeof(buf) - 1 - res;
cwd = ZCG(cwd_key);
memcpy(ZCG(cwd_key), res, cwd_len + 1);
+ } else {
+ return NULL;
}
+ } else {
+ return NULL;
}
}
}
@@ -1216,7 +1219,11 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int
*key_l
include_path_len = ZCG(include_path_key_len) = buf + sizeof(buf) - 1 - res;
include_path = ZCG(include_path_key);
memcpy(ZCG(include_path_key), res, include_path_len + 1);
+ } else {
+ return NULL;
}
+ } else {
+ return NULL;
}
}
}
@@ -2290,6 +2297,7 @@ static void accel_reset_pcre_cache(void)
int accel_activate(INIT_FUNC_ARGS)
{
if (!ZCG(enabled) || !accel_startup_ok) {
+ ZCG(accelerator_enabled) = 0;
return SUCCESS;
}
@@ -2306,6 +2314,7 @@ int accel_activate(INIT_FUNC_ARGS)
ZCG(cwd_check) = 1;
if (file_cache_only) {
+ ZCG(accelerator_enabled) = 0;
return SUCCESS;
}