Skip to content

Commit 1c22ace

Browse files
committed
Fixed bug #77660 (Segmentation fault on break 2147483648)
1 parent 4a72dd7 commit 1c22ace

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2019, PHP 7.2.17
44

55
- Core:
6+
. Fixed bug #77660 (Segmentation fault on break 2147483648). (Laruence)
67
. Fixed bug #77652 (Anonymous classes can lose their interface information).
78
(Nikita)
89

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
@@ -4508,7 +4508,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
45084508
zend_ast *depth_ast = ast->child[0];
45094509

45104510
zend_op *opline;
4511-
int depth;
4511+
zend_long depth;
45124512

45134513
ZEND_ASSERT(ast->kind == ZEND_AST_BREAK || ast->kind == ZEND_AST_CONTINUE);
45144514

@@ -4535,7 +4535,7 @@ void zend_compile_break_continue(zend_ast *ast) /* {{{ */
45354535
ast->kind == ZEND_AST_BREAK ? "break" : "continue");
45364536
} else {
45374537
if (!zend_handle_loops_and_finally_ex(depth, NULL)) {
4538-
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' %d level%s",
4538+
zend_error_noreturn(E_COMPILE_ERROR, "Cannot '%s' " ZEND_LONG_FMT " level%s",
45394539
ast->kind == ZEND_AST_BREAK ? "break" : "continue",
45404540
depth, depth == 1 ? "" : "s");
45414541
}

0 commit comments

Comments
 (0)