]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6' into PHP-7.0
authorXinchen Hui <laruence@gmail.com>
Mon, 15 Feb 2016 02:32:50 +0000 (10:32 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 15 Feb 2016 02:32:50 +0000 (10:32 +0800)
* PHP-5.6:
  Update NEWS: "Fixed bug  #71584 (Possible use-after-free of ZCG(cwd) in Zend Opcache)"
  Fix use-after-free of ZCG(cwd) in Zend Optimizer

Conflicts:
ext/opcache/ZendAccelerator.c

1  2 
ext/opcache/ZendAccelerator.c

index 2440a565821bd7d8bbf656b8f5fa07e7208d2e34,0f66c56ea65d068bc36af67b014802f2d5bc9700..f0dc77010984efd882e35df320f62ca8d0c42825
@@@ -2283,7 -2368,13 +2283,12 @@@ static void accel_deactivate(void
         * In general, they're restored by persistent_compile_file(), but in case
         * the script is aborted abnormally, they may become messed up.
         */
 -      TSRMLS_FETCH();
  
 -              efree(ZCG(cwd));
+       if (ZCG(cwd)) {
++              zend_string_release(ZCG(cwd));
+               ZCG(cwd) = NULL;
+       }
        if (!ZCG(enabled) || !accel_startup_ok) {
                return;
        }
        ZCG(counted) = 0;
  
  #if !ZEND_DEBUG
 -      if (ZCG(accel_directives).fast_shutdown) {
 -              zend_accel_fast_shutdown(TSRMLS_C);
 +      if (ZCG(accel_directives).fast_shutdown && is_zend_mm()) {
 +              zend_accel_fast_shutdown();
        }
  #endif
-       if (ZCG(cwd)) {
-               zend_string_release(ZCG(cwd));
-               ZCG(cwd) = NULL;
-       }
  }
  
  static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2)