Skip to content

Commit d417072

Browse files
committed
Fix phpGH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
Closes phpGH-13234.
1 parent 1c1d785 commit d417072

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ PHP NEWS
2020
. Fixed bug GH-12107 (When running a stored procedure (that returns a result
2121
set) twice, PHP crashes). (nielsdos)
2222

23+
- Opcache:
24+
. Fixed bug GH-13232 (Segmentation fault will be reported when JIT is off but
25+
JIT_debug is still on). (nielsdos)
26+
2327
- OpenSSL:
2428
. Fixed LibreSSL undefined reference when OPENSSL_NO_ENGINE not set.
2529
(David Carlier).

ext/opcache/jit/zend_jit.c

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

50415041
ZEND_EXT_API void zend_jit_shutdown(void)
50425042
{
5043-
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) {
5043+
if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE && dasm_ptr != NULL) {
50445044
fprintf(stderr, "\nJIT memory usage: %td\n", (ptrdiff_t)((char*)*dasm_ptr - (char*)dasm_buf));
50455045
}
50465046

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)