com php-src: Fixed bug #71413 (Crash with constants on internal interfaces): Zend/zend_inheritance.c

From: Date: Thu, 21 Jan 2016 05:30:41 +0000
Subject: com php-src: Fixed bug #71413 (Crash with constants on internal interfaces): Zend/zend_inheritance.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90718@lists.php.net to get a copy of this message
Commit: 62c1c11ad34103729988df9edea343337a900ba9 Author: Xinchen Hui <laruence@gmail.com> Thu, 21 Jan 2016 13:30:41 +0800 Parents: dcf3db6ac86d5a2fb58cd337b691de820c160c3f Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62c1c11ad34103729988df9edea343337a900ba9 Log: Fixed bug #71413 (Crash with constants on internal interfaces) Bugs: https://bugs.php.net/71413 Changed paths: M Zend/zend_inheritance.c Diff: diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index c4b2284..2226f60 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -933,13 +933,20 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zen static void do_inherit_iface_constant(zend_string *name, zend_class_constant *c, zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ { if (do_inherit_constant_check(&ce->constants_table, c, name, iface)) { + zend_class_constant *ct; if (Z_REFCOUNTED(c->value)) { Z_ADDREF(c->value); } if (Z_CONSTANT(c->value)) { ce->ce_flags &= ~ZEND_ACC_CONSTANTS_UPDATED; } - zend_hash_update_ptr(&ce->constants_table, name, c); + if (ce->type & ZEND_INTERNAL_CLASS) { + ct = pemalloc(sizeof(zend_class_constant), 1); + } else { + ct = zend_arena_alloc(&CG(arena), sizeof(zend_class_constant)); + } + memcpy(ct, c, sizeof(zend_class_constant)); + zend_hash_update_ptr(&ce->constants_table, name, ct); } } /* }}} */

« previous php.cvs (#90718) next »