Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_0) / zend_ini.c

From: Date: Wed, 13 Apr 2005 08:01:31 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_0) / zend_ini.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3556@lists.php.net to get a copy of this message
    Does not happen in PHP_4_3 branch..?
    --Jani
On Tue, 12 Apr 2005, Stanislav Malyshev wrote:
stas Tue Apr 12 08:59:39 2005 EDT
 Modified files:              (Branch: PHP_5_0)
/ZendEngine2 zend_ini.c Log: fi memory corruption if one on the on_modify handlers errors out http://cvs.php.net/diff.php/ZendEngine2/zend_ini.c?r1=1.33.2.2&r2=1.33.2.3&ty=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.33.2.2 ZendEngine2/zend_ini.c:1.33.2.3 --- ZendEngine2/zend_ini.c:1.33.2.2 Wed Nov 3 18:14:31 2004 +++ ZendEngine2/zend_ini.c Tue Apr 12 08:59:36 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.33.2.2 2004/11/03 23:14:31 derick Exp $ */ +/* $Id: zend_ini.c,v 1.33.2.3 2005/04/12 12:59:36 stas Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -48,7 +48,12 @@ { if (ini_entry->modified) { if (ini_entry->on_modify) { - ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); + zend_try { + /* even if on_modify bails out, we have to continue on with restoring, + since there can be allocated variables that would be freed on MM shutdown + and would lead to memory corruption later ini entry is modified again */ + ini_entry->on_modify(ini_entry, ini_entry->orig_value, ini_entry->orig_value_length, ini_entry->mh_arg1, ini_entry->mh_arg2, ini_entry->mh_arg3, stage TSRMLS_CC); + } zend_end_try(); } efree(ini_entry->value); ini_entry->value = ini_entry->orig_value;
-- https://www.paypal.com/xclick/business=sniper@php.net&no_note=1&tax=0&currency_code=EUR

« previous php.zend-engine.cvs (#3556) next »