Skip to content

Commit a297c09

Browse files
committed
Partial fixed bug #79649 (Altering disable_functions from module init corrupts memory)
In module startup stage, we should not initiliaze EG(modified_ini_directives) as it use zend MM, the zend MM will be restart at the end of modules startup stage, by say "partial", because this issue still exists if altering ZEND_USER inis, we should add a zend_ini_deactive at the end of modules startup stage, but it brings some new cost, and I think no one would do things like that
1 parent 3c12c41 commit a297c09

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2020, PHP 7.4.8
44

55
- Core:
6+
. Fixed bug #79649 (Altering disable_functions from module init corrupts
7+
memory). (Laruence)
68
. Fixed bug #79595 (zend_init_fpu() alters FPU precision). (cmb, Nikita)
79
. Fixed bug #79650 (php-win.exe 100% cpu lockup). (cmb)
810
. Fixed bug #79668 (get_defined_functions(true) may miss functions). (cmb,

Zend/zend_ini.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,17 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
341341
}
342342
}
343343

344-
if (!EG(modified_ini_directives)) {
345-
ALLOC_HASHTABLE(EG(modified_ini_directives));
346-
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
347-
}
348-
if (!modified) {
349-
ini_entry->orig_value = ini_entry->value;
350-
ini_entry->orig_modifiable = modifiable;
351-
ini_entry->modified = 1;
352-
zend_hash_add_ptr(EG(modified_ini_directives), ini_entry->name, ini_entry);
344+
if (ini_entry->modifiable != ZEND_INI_SYSTEM) {
345+
if (!EG(modified_ini_directives)) {
346+
ALLOC_HASHTABLE(EG(modified_ini_directives));
347+
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
348+
}
349+
if (!modified) {
350+
ini_entry->orig_value = ini_entry->value;
351+
ini_entry->orig_modifiable = modifiable;
352+
ini_entry->modified = 1;
353+
zend_hash_add_ptr(EG(modified_ini_directives), ini_entry->name, ini_entry);
354+
}
353355
}
354356

355357
duplicate = zend_string_copy(new_value);

0 commit comments

Comments
 (0)