Skip to content

Commit 0faa1d2

Browse files
committed
Fix MSAN getservbyport() false positive
Closes GH-15814
1 parent 1f35e2a commit 0faa1d2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext/standard/basic_functions.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ PHPAPI php_basic_globals basic_globals;
112112
#include "streamsfuncs.h"
113113
#include "basic_functions_arginfo.h"
114114

115+
#if __has_feature(memory_sanitizer)
116+
# include <sanitizer/msan_interface.h>
117+
#endif
118+
115119
typedef struct _user_tick_function_entry {
116120
zend_fcall_info fci;
117121
zend_fcall_info_cache fci_cache;
@@ -2263,6 +2267,10 @@ PHP_FUNCTION(getservbyport)
22632267
RETURN_FALSE;
22642268
}
22652269

2270+
/* MSAN false positive, getservbyport() is not properly intercepted. */
2271+
#if __has_feature(memory_sanitizer)
2272+
__msan_unpoison_string(serv->s_name);
2273+
#endif
22662274
RETURN_STRING(serv->s_name);
22672275
}
22682276
/* }}} */

0 commit comments

Comments
 (0)