Skip to content

Commit 2db6d8e

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed use-after-free
2 parents a18a11c + b6a41ad commit 2db6d8e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ext/opcache/zend_persist.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -852,13 +852,6 @@ static void zend_accel_persist_class_table(HashTable *class_table)
852852
zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length, int for_shm)
853853
{
854854
script->mem = ZCG(mem);
855-
script->corrupted = 0;
856-
ZCG(current_persistent_script) = script;
857-
858-
if (!for_shm) {
859-
/* script is not going to be saved in SHM */
860-
script->corrupted = 1;
861-
}
862855

863856
ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */
864857
zend_shared_alloc_clear_xlat_table();
@@ -867,6 +860,15 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
867860
if (key && *key) {
868861
*key = zend_accel_memdup(*key, key_length + 1);
869862
}
863+
864+
script->corrupted = 0;
865+
ZCG(current_persistent_script) = script;
866+
867+
if (!for_shm) {
868+
/* script is not going to be saved in SHM */
869+
script->corrupted = 1;
870+
}
871+
870872
zend_accel_store_interned_string(script->script.filename);
871873

872874
#ifdef __SSE2__

0 commit comments

Comments
 (0)