]> granicus.if.org Git - php/commitdiff
Fixed segfault in BEGIN/END SILENT
authorXinchen Hui <laruence@gmail.com>
Wed, 19 Feb 2014 10:34:27 +0000 (18:34 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 19 Feb 2014 10:34:27 +0000 (18:34 +0800)
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 58dcb48ce83402409757372dd0ececdac4717083..0a9d86490d819be25f3ca367b3f2b997a8a9ee47 100644 (file)
@@ -4676,7 +4676,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
                            EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
                                efree(EG(error_reporting_ini_entry)->value);
                        }
-                       EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting);
+                       EG(error_reporting_ini_entry)->value = estrndup(Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting));
                        EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting);
                } else {
                        zval_dtor(&restored_error_reporting);
index cd0395c6c61cc7b51e18bb56b19b733a39ac9036..7505189e51ac5bf6950bbda78591a150842af53c 100644 (file)
@@ -8100,7 +8100,7 @@ static int ZEND_FASTCALL  ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
                            EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value)) {
                                efree(EG(error_reporting_ini_entry)->value);
                        }
-                       EG(error_reporting_ini_entry)->value = Z_STRVAL(restored_error_reporting);
+                       EG(error_reporting_ini_entry)->value = estrndup(Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting));
                        EG(error_reporting_ini_entry)->value_length = Z_STRLEN(restored_error_reporting);
                } else {
                        zval_dtor(&restored_error_reporting);