diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2018-03-14 09:14:16 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2018-03-14 09:14:16 +0300 |
| commit | 2db6d8e41538e602fffd99ca3ea8fd2749bb9b31 (patch) | |
| tree | 69115d57118e6cbaf64ca69dcd134ae2cd592f1e | |
| parent | a18a11cf80ad067e6431a06a7a370d1e1d7d9472 (diff) | |
| parent | b6a41ad5ba2f853d44e6184375968a86c8167f1e (diff) | |
| download | php-git-2db6d8e41538e602fffd99ca3ea8fd2749bb9b31.tar.gz | |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fixed use-after-free
| -rw-r--r-- | ext/opcache/zend_persist.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index c57f80224b..006398980a 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -852,13 +852,6 @@ static void zend_accel_persist_class_table(HashTable *class_table) zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length, int for_shm) { script->mem = ZCG(mem); - script->corrupted = 0; - ZCG(current_persistent_script) = script; - - if (!for_shm) { - /* script is not going to be saved in SHM */ - script->corrupted = 1; - } ZEND_ASSERT(((zend_uintptr_t)ZCG(mem) & 0x7) == 0); /* should be 8 byte aligned */ zend_shared_alloc_clear_xlat_table(); @@ -867,6 +860,15 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script if (key && *key) { *key = zend_accel_memdup(*key, key_length + 1); } + + script->corrupted = 0; + ZCG(current_persistent_script) = script; + + if (!for_shm) { + /* script is not going to be saved in SHM */ + script->corrupted = 1; + } + zend_accel_store_interned_string(script->script.filename); #ifdef __SSE2__ |
