From b9fdc0bdcd7b6fe7ed0c6b5bc3e8c920bb1d486d Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 9 Sep 2024 17:13:43 +0200 Subject: [PATCH 1/3] Fix uninitialized EG(user_error_handler_error_reporting) Closes GH-15812 --- Zend/zend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend.c b/Zend/zend.c index fc092b66b9e..e882d0822f2 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -775,6 +775,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{ zend_init_call_trampoline_op(); memset(&executor_globals->trampoline, 0, sizeof(zend_op_array)); executor_globals->capture_warnings_during_sccp = 0; + executor_globals->user_error_handler_error_reporting = 0; ZVAL_UNDEF(&executor_globals->user_error_handler); ZVAL_UNDEF(&executor_globals->user_exception_handler); executor_globals->in_autoload = NULL; From 1f35e2a999d2fdd6ed2e58e871953331fcc925a9 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 9 Sep 2024 17:23:26 +0200 Subject: [PATCH 2/3] Fix uninitialized CG(zend_lineno) Closes GH-15813 --- Zend/zend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Zend/zend.c b/Zend/zend.c index e882d0822f2..097018bf8bf 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -705,6 +705,7 @@ static void auto_global_copy_ctor(zval *zv) /* {{{ */ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */ { compiler_globals->compiled_filename = NULL; + compiler_globals->zend_lineno = 0; compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1); From 0faa1d2017db86d29ea03941f60a525e5754bd6c Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 9 Sep 2024 17:32:52 +0200 Subject: [PATCH 3/3] Fix MSAN getservbyport() false positive Closes GH-15814 --- ext/standard/basic_functions.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a368d0ac7f2..7bc7122b859 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -112,6 +112,10 @@ PHPAPI php_basic_globals basic_globals; #include "streamsfuncs.h" #include "basic_functions_arginfo.h" +#if __has_feature(memory_sanitizer) +# include +#endif + typedef struct _user_tick_function_entry { zend_fcall_info fci; zend_fcall_info_cache fci_cache; @@ -2263,6 +2267,10 @@ PHP_FUNCTION(getservbyport) RETURN_FALSE; } + /* MSAN false positive, getservbyport() is not properly intercepted. */ +#if __has_feature(memory_sanitizer) + __msan_unpoison_string(serv->s_name); +#endif RETURN_STRING(serv->s_name); } /* }}} */