Skip to content

Fix GH-17727: JIT SEGV on OOM in dtor when creating backtrace #17732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -9327,6 +9327,7 @@ static int zend_jit_init_static_method_call(zend_jit_ctx *jit,
ir_IF_FALSE_cold(if_static);
}

jit_SET_EX_OPLINE(jit, opline);
ref = ir_CALL_3(IR_ADDR, ir_CONST_FC_FUNC(zend_jit_push_this_method_call_frame),
scope_ref,
func_ref,
Expand Down
31 changes: 31 additions & 0 deletions ext/opcache/tests/jit/gh17727.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
GH-17727 (JIT SEGV on OOM in dtor when creating backtrace)
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
?>
--INI--
opcache.jit=1254
fatal_error_backtraces=1
memory_limit=2M
--CREDITS--
arnaud-lb
YuanchengJiang
--FILE--
<?php
$str = str_repeat('a', 1024 * 1024 * 1.25);
class DestructableObject
{
public function __destruct()
{
DestructableObject::__destruct();
}
}
$_ = new DestructableObject();
?>
--EXPECTF--
Fatal error: Allowed memory size of 2097152 bytes exhausted %s
Stack trace:
%A