diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-02 12:07:19 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-02 12:07:19 +0200 |
commit | 3c42471ef84dcd6008ee54c0dc6cecb47b5da86b (patch) | |
tree | 5e42580d5be7bdf76a2ec5c6b7716947117bfc02 /Zend | |
parent | f7596d1b5bd263ee7e0371d125bee37a675c0c7e (diff) | |
parent | a5d3620d937f69665d78ab8d21c757d3db17b5ec (diff) | |
download | php-git-3c42471ef84dcd6008ee54c0dc6cecb47b5da86b.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/halt_compiler5.phpt | 8 | ||||
-rw-r--r-- | Zend/zend_compile.c | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Zend/tests/halt_compiler5.phpt b/Zend/tests/halt_compiler5.phpt new file mode 100644 index 0000000000..71d973e4f7 --- /dev/null +++ b/Zend/tests/halt_compiler5.phpt @@ -0,0 +1,8 @@ +--TEST-- +Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895) +--FILE-- +<?php +__COMPILER_HALT_OFFSET__; +{} +--EXPECTF-- +Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' (this will throw an Error in a future version of PHP) in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0c576a86ca..fbf65822d4 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7764,6 +7764,9 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */ while (last && last->kind == ZEND_AST_STMT_LIST) { zend_ast_list *list = zend_ast_get_list(last); + if (list->children == 0) { + break; + } last = list->child[list->children-1]; } if (last && last->kind == ZEND_AST_HALT_COMPILER) { |