(Nikita)
. Fixed bug #78598 (Changing array during undef index RW error segfaults).
(Nikita)
+ . Fixed bug #79784 (Use after free if changing array during undef var during
+ array write fetch). (Nikita)
- Fileinfo:
. Fixed bug #79756 (finfo_file crash (FILEINFO_MIME)). (cmb)
FREE_OP(free_op_data1);
}
-static zend_never_inline zend_uchar slow_index_convert(const zval *dim, zend_value *value EXECUTE_DATA_DC)
+static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval *dim, zend_value *value EXECUTE_DATA_DC)
{
switch (Z_TYPE_P(dim)) {
- case IS_UNDEF:
+ case IS_UNDEF: {
+ /* The array may be destroyed while throwing the notice.
+ * Temporarily increase the refcount to detect this situation. */
+ if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE)) {
+ GC_ADDREF(ht);
+ }
ZVAL_UNDEFINED_OP2();
+ if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE) && !GC_DELREF(ht)) {
+ zend_array_destroy(ht);
+ return IS_NULL;
+ }
+ if (EG(exception)) {
+ return IS_NULL;
+ }
/* break missing intentionally */
+ }
case IS_NULL:
value->str = ZSTR_EMPTY_ALLOC();
return IS_STRING;
goto try_again;
} else {
zend_value val;
- zend_uchar t = slow_index_convert(dim, &val EXECUTE_DATA_CC);
+ zend_uchar t = slow_index_convert(ht, dim, &val EXECUTE_DATA_CC);
if (t == IS_STRING) {
offset_key = val.str;