Skip to content

Commit b62c6e5

Browse files
committed
Also protect memory during opcache_compile_file
1 parent daf0c95 commit b62c6e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,9 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
15701570

15711571
/* check blacklist right after ensuring that file was opened */
15721572
if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, ZSTR_VAL(file_handle->opened_path))) {
1573+
SHM_UNPROTECT();
15731574
ZCSG(blacklist_misses)++;
1575+
SHM_PROTECT();
15741576
*op_array_p = accelerator_orig_compile_file(file_handle, type);
15751577
return NULL;
15761578
}
@@ -1601,7 +1603,9 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl
16011603
}
16021604

16031605
if (ZCG(accel_directives).max_file_size > 0 && size > (size_t)ZCG(accel_directives).max_file_size) {
1606+
SHM_UNPROTECT();
16041607
ZCSG(blacklist_misses)++;
1608+
SHM_PROTECT();
16051609
*op_array_p = accelerator_orig_compile_file(file_handle, type);
16061610
return NULL;
16071611
}
@@ -2003,9 +2007,11 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
20032007
return accelerator_orig_compile_file(file_handle, type);
20042008
}
20052009

2010+
SHM_PROTECT();
20062011
HANDLE_UNBLOCK_INTERRUPTIONS();
20072012
persistent_script = opcache_compile_file(file_handle, type, key, &op_array);
20082013
HANDLE_BLOCK_INTERRUPTIONS();
2014+
SHM_UNPROTECT();
20092015

20102016
/* Try and cache the script and assume that it is returned from_shared_memory.
20112017
* If it isn't compile_and_cache_file() changes the flag to 0

0 commit comments

Comments
 (0)