diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index df965a4dbc76f..c4f169f811643 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -5040,7 +5040,7 @@ ZEND_EXT_API int zend_jit_startup(void *buf, size_t size, bool reattached) ZEND_EXT_API void zend_jit_shutdown(void) { - if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE) { + if (JIT_G(debug) & ZEND_JIT_DEBUG_SIZE && dasm_ptr != NULL) { fprintf(stderr, "\nJIT memory usage: %td\n", (ptrdiff_t)((char*)*dasm_ptr - (char*)dasm_buf)); } diff --git a/ext/opcache/tests/jit/gh13232.phpt b/ext/opcache/tests/jit/gh13232.phpt new file mode 100644 index 0000000000000..aad5a7913f8a6 --- /dev/null +++ b/ext/opcache/tests/jit/gh13232.phpt @@ -0,0 +1,13 @@ +--TEST-- +GH-13232 (Segmentation fault will be reported when JIT is off but JIT_debug is still on) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=disable +opcache.jit_debug=0xfffff +--FILE-- + +--EXPECT-- +Done