Skip to content

Commit e8768b3

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fixed bug #77660 (Segmentation fault on break 2147483648)
2 parents 3b5475e + 1c22ace commit e8768b3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Zend/tests/bug77660.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #77660 (Segmentation fault on break 2147483648)
3+
--SKIPIF--
4+
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
5+
--FILE--
6+
<?php
7+
for(;;) break 2147483648;
8+
?>
9+
--EXPECTF--
10+
Fatal error: Cannot 'break' 2147483648 levels in %sbug77660.php on line %d

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4528,7 +4528,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
45284528
zend_ast *depth_ast = ast->child[0];
45294529

45304530
zend_op *opline;
4531-
int depth;
4531+
zend_long depth;
45324532

45334533
ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE);
45344534

@@ -4555,7 +4555,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
45554555
ast->kind == ZEND_AST_BREAK ? "break" : "continue");
45564556
} else {
45574557
if (!zend_handle_loops_and_finally_ex(depth, NULL)) {
4558-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' %d level%s",
4558+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' " ZEND_LONG_FMT " level%s",
45594559
ast->kind == ZEND_AST_BREAK ? "break" : "continue",
45604560
depth, depth == 1 ? "" : "s");
45614561
}

0 commit comments

Comments
 (0)