Skip to content

Commit e2c3c48

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
2 parents bcd4138 + 31e8cea commit e2c3c48

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ ZEND_EXT_API void zend_jit_startup(void *buf, size_t size, bool reattached)
35113511

35123512
ZEND_EXT_API void zend_jit_shutdown(void)
35133513
{
3514-
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) {
3514+
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE && dasm_ptr != NULL) {
35153515
fprintf(stderr, "\nJIT memory usage: %td\n", (ptrdiff_t)((char*)*dasm_ptr - (char*)dasm_buf));
35163516
}
35173517

ext/opcache/tests/jit/gh13232.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
GH-13232 (Segmentation fault will be reported when JIT is off but JIT_debug is still on)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.jit=disable
7+
opcache.jit_debug=0xfffff
8+
--FILE--
9+
<?php
10+
echo "Done\n";
11+
?>
12+
--EXPECT--
13+
Done

0 commit comments

Comments
 (0)