Skip to content

Commit 6ed730e

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix MSAN getservbyport() false positive Fix uninitialized CG(zend_lineno) Fix uninitialized EG(user_error_handler_error_reporting)
2 parents b5c378c + a5bd4cc commit 6ed730e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Zend/zend.c

+2
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ static void auto_global_copy_ctor(zval *zv) /* {{{ */
711711
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
712712
{
713713
compiler_globals->compiled_filename = NULL;
714+
compiler_globals->zend_lineno = 0;
714715

715716
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
716717
zend_hash_init(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1);
@@ -803,6 +804,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
803804
zend_init_call_trampoline_op();
804805
memset(&executor_globals->trampoline, 0, sizeof(zend_op_array));
805806
executor_globals->capture_warnings_during_sccp = 0;
807+
executor_globals->user_error_handler_error_reporting = 0;
806808
ZVAL_UNDEF(&executor_globals->user_error_handler);
807809
ZVAL_UNDEF(&executor_globals->user_exception_handler);
808810
executor_globals->in_autoload = NULL;

ext/standard/basic_functions.c

+8
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ PHPAPI php_basic_globals basic_globals;
117117
#include "zend_frameless_function.h"
118118
#include "basic_functions_arginfo.h"
119119

120+
#if __has_feature(memory_sanitizer)
121+
# include <sanitizer/msan_interface.h>
122+
#endif
123+
120124
typedef struct _user_tick_function_entry {
121125
zend_fcall_info fci;
122126
zend_fcall_info_cache fci_cache;
@@ -2233,6 +2237,10 @@ PHP_FUNCTION(getservbyport)
22332237
RETURN_FALSE;
22342238
}
22352239

2240+
/* MSAN false positive, getservbyport() is not properly intercepted. */
2241+
#if __has_feature(memory_sanitizer)
2242+
__msan_unpoison_string(serv->s_name);
2243+
#endif
22362244
RETURN_STRING(serv->s_name);
22372245
}
22382246
/* }}} */

0 commit comments

Comments
 (0)