diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-07 16:24:13 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-07 16:29:48 +0200 |
commit | 77acc8a069acbdd0e4ab0ac43f7d676a23e413a1 (patch) | |
tree | 3cc260f2071b4cfbdac17c4e85a270629360edc5 /Zend/tests/bug79793.phpt | |
parent | 62bec0e083aee4cba17d459fb4e07e1599772b12 (diff) | |
download | php-git-77acc8a069acbdd0e4ab0ac43f7d676a23e413a1.tar.gz |
Fixed bug #79793
Make sure the string key is not released while throwing the
undefined index warning.
Diffstat (limited to 'Zend/tests/bug79793.phpt')
-rw-r--r-- | Zend/tests/bug79793.phpt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Zend/tests/bug79793.phpt b/Zend/tests/bug79793.phpt new file mode 100644 index 0000000000..9e4e2e20be --- /dev/null +++ b/Zend/tests/bug79793.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #79793: Use after free if string used in undefined index warning is changed +--FILE-- +<?php + +$key = "foo"; +$key .= "bar"; +set_error_handler(function($_, $m) use (&$key) { + echo "$m\n"; + $key .= "baz"; +}); + +$ary = []; +$ary[$key]++; +var_dump($ary); +$ary[$key] += 1; +var_dump($ary); + +?> +--EXPECT-- +Undefined index: foobar +array(1) { + ["foobar"]=> + int(1) +} +Undefined index: foobarbaz +array(2) { + ["foobar"]=> + int(1) + ["foobarbaz"]=> + int(1) +} |