cvs: Zend(PHP_4_3) / zend_ini.c

From: Date: Wed, 13 Apr 2005 11:07:54 +0000
Subject: cvs: Zend(PHP_4_3) / zend_ini.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3559@lists.php.net to get a copy of this message
stas Wed Apr 13 07:07:54 2005 EDT Modified files: (Branch: PHP_4_3) /Zend zend_ini.c Log: MF5: fix memory corruption if one on the on_modify handlers errors out http://cvs.php.net/diff.php/Zend/zend_ini.c?r1=1.23.2.6&r2=1.23.2.7&ty=u Index: Zend/zend_ini.c diff -u Zend/zend_ini.c:1.23.2.6 Zend/zend_ini.c:1.23.2.7 --- Zend/zend_ini.c:1.23.2.6 Sun Jan 9 12:00:16 2005 +++ Zend/zend_ini.c Wed Apr 13 07:07:50 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.23.2.6 2005/01/09 17:00:16 sniper Exp $ */ +/* $Id: zend_ini.c,v 1.23.2.7 2005/04/13 11:07:50 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;

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