diff options
author | Xinchen Hui <laruence@gmail.com> | 2019-02-25 15:00:23 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2019-02-25 15:00:23 +0800 |
commit | e8768b338c69a1b0d898b202b67ed01b7011827e (patch) | |
tree | 5ec1d9b6639fa1c0fa5ec2328c0aa13b6f2d97b1 | |
parent | 3b5475e9ee48c27f7164eb1d9cbe873d2704b571 (diff) | |
parent | 1c22ace0582fb0a2ec581237fcf1c5b9c41edd04 (diff) | |
download | php-git-e8768b338c69a1b0d898b202b67ed01b7011827e.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
Fixed bug #77660 (Segmentation fault on break 2147483648)
-rw-r--r-- | Zend/tests/bug77660.phpt | 10 | ||||
-rw-r--r-- | Zend/zend_compile.c | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/Zend/tests/bug77660.phpt b/Zend/tests/bug77660.phpt new file mode 100644 index 0000000000..94af1f9e2c --- /dev/null +++ b/Zend/tests/bug77660.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #77660 (Segmentation fault on break 2147483648) +--SKIPIF-- +<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> +--FILE-- +<?php +for(;;) break 2147483648; +?> +--EXPECTF-- +Fatal error: Cannot 'break' 2147483648 levels in %sbug77660.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b7fa412d9f..aa1853aff7 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4528,7 +4528,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */ zend_ast *depth_ast = ast->child[0]; zend_op *opline; - int depth; + zend_long depth; ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE); @@ -4555,7 +4555,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */ ast->kind == ZEND_AST_BREAK ? "break" : "continue"); } else { if (!zend_handle_loops_and_finally_ex(depth, NULL)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' %d level%s", + zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' " ZEND_LONG_FMT " level%s", ast->kind == ZEND_AST_BREAK ? "break" : "continue", depth, depth == 1 ? "" : "s"); } |