Skip to content

Commit 31e8cea

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

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ PHP NEWS
2828
- Opcache:
2929
. Fixed bug GH-13145 (strtok() is not comptime). (ilutov)
3030
. Fixed type inference of range(). (ilutov)
31+
. Fixed bug GH-13232 (Segmentation fault will be reported when JIT is off but
32+
JIT_debug is still on). (nielsdos)
3133

3234
- OpenSSL:
3335
. Fixed LibreSSL undefined reference when OPENSSL_NO_ENGINE not set.

ext/opcache/jit/zend_jit.c

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

50555055
ZEND_EXT_API void zend_jit_shutdown(void)
50565056
{
5057-
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) {
5057+
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE && dasm_ptr != NULL) {
50585058
fprintf(stderr, "\nJIT memory usage: %td\n", (ptrdiff_t)((char*)*dasm_ptr - (char*)dasm_buf));
50595059
}
50605060

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)