Skip to content

Commit a5bd4cc

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix MSAN getservbyport() false positive Fix uninitialized CG(zend_lineno) Fix uninitialized EG(user_error_handler_error_reporting)
2 parents 3667e7e + 0faa1d2 commit a5bd4cc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Zend/zend.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ static void auto_global_copy_ctor(zval *zv) /* {{{ */
703703
static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
704704
{
705705
compiler_globals->compiled_filename = NULL;
706+
compiler_globals->zend_lineno = 0;
706707

707708
compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
708709
zend_hash_init(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1);
@@ -789,6 +790,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
789790
zend_init_call_trampoline_op();
790791
memset(&executor_globals->trampoline, 0, sizeof(zend_op_array));
791792
executor_globals->capture_warnings_during_sccp = 0;
793+
executor_globals->user_error_handler_error_reporting = 0;
792794
ZVAL_UNDEF(&executor_globals->user_error_handler);
793795
ZVAL_UNDEF(&executor_globals->user_exception_handler);
794796
executor_globals->in_autoload = NULL;

ext/standard/basic_functions.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ PHPAPI php_basic_globals basic_globals;
117117
#include "streamsfuncs.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;
@@ -2255,6 +2259,10 @@ PHP_FUNCTION(getservbyport)
22552259
RETURN_FALSE;
22562260
}
22572261

2262+
/* MSAN false positive, getservbyport() is not properly intercepted. */
2263+
#if __has_feature(memory_sanitizer)
2264+
__msan_unpoison_string(serv->s_name);
2265+
#endif
22582266
RETURN_STRING(serv->s_name);
22592267
}
22602268
/* }}} */

0 commit comments

Comments
 (0)