Skip to content

Commit 926407f

Browse files
authored
Fix some MSAN complaints under Clang (#8553)
1 parent cd6ae60 commit 926407f

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

Zend/zend_stream.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void zend_stream_stdio_closer(void *handle) /* {{{ */
3939

4040
static size_t zend_stream_stdio_fsizer(void *handle) /* {{{ */
4141
{
42-
zend_stat_t buf;
42+
zend_stat_t buf = {0};
4343
if (handle && zend_fstat(fileno((FILE*)handle), &buf) == 0) {
4444
#ifdef S_ISREG
4545
if (!S_ISREG(buf.st_mode)) {

Zend/zend_virtual_cwd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
502502
do { free(pathw); } while(0);
503503

504504
#else
505-
zend_stat_t st;
505+
zend_stat_t st = {0};
506506
#endif
507507
realpath_cache_bucket *bucket;
508508
char *tmp;

ext/opcache/ZendAccelerator.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha
994994

995995
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size)
996996
{
997-
zend_stat_t statbuf;
997+
zend_stat_t statbuf = {0};
998998
#ifdef ZEND_WIN32
999999
accel_time_t res;
10001000
#endif

ext/opcache/zend_accelerator_module.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static ZEND_INI_MH(OnUpdateFileCache)
134134
if (!ZSTR_LEN(new_value)) {
135135
new_value = NULL;
136136
} else {
137-
zend_stat_t buf;
137+
zend_stat_t buf = {0};
138138

139139
if (!IS_ABSOLUTE_PATH(ZSTR_VAL(new_value), ZSTR_LEN(new_value)) ||
140140
zend_stat(ZSTR_VAL(new_value), &buf) != 0 ||

ext/standard/dir.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ PHP_FUNCTION(glob)
505505
* able to filter directories out.
506506
*/
507507
if (flags & GLOB_ONLYDIR) {
508-
zend_stat_t s;
508+
zend_stat_t s = {0};
509509

510510
if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) {
511511
continue;

ext/standard/dns.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static void _php_dns_free_res(struct __res_state *res) { /* {{{ */
384384
PHP_FUNCTION(dns_check_record)
385385
{
386386
HEADER *hp;
387-
querybuf answer;
387+
querybuf answer = {0};
388388
char *hostname;
389389
size_t hostname_len;
390390
zend_string *rectype = NULL;
@@ -470,7 +470,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
470470
long n, i;
471471
u_short s;
472472
u_char *tp, *p;
473-
char name[MAXHOSTNAMELEN];
473+
char name[MAXHOSTNAMELEN] = {0};
474474
int have_v6_break = 0, in_v6_break = 0;
475475

476476
ZVAL_UNDEF(subarray);
@@ -839,7 +839,7 @@ PHP_FUNCTION(dns_get_record)
839839
struct __res_state *handle = &state;
840840
#endif
841841
HEADER *hp;
842-
querybuf answer;
842+
querybuf answer = {0};
843843
u_char *cp = NULL, *end = NULL;
844844
int n, qd, an, ns = 0, ar = 0;
845845
int type, first_query = 1, store_results = 1;
@@ -1069,8 +1069,8 @@ PHP_FUNCTION(dns_get_mx)
10691069
zval *mx_list, *weight_list = NULL;
10701070
int count, qdc;
10711071
u_short type, weight;
1072-
querybuf answer;
1073-
char buf[MAXHOSTNAMELEN];
1072+
querybuf answer = {0};
1073+
char buf[MAXHOSTNAMELEN] = {0};
10741074
HEADER *hp;
10751075
u_char *cp, *end;
10761076
int i;

ext/standard/filestat.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,8 @@ PHP_FUNCTION(clearstatcache)
740740
/* {{{ php_stat */
741741
PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
742742
{
743-
zend_stat_t *stat_sb;
744-
php_stream_statbuf ssb;
743+
zend_stat_t *stat_sb = {0};
744+
php_stream_statbuf ssb = {0};
745745
int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
746746
const char *local = NULL;
747747
php_stream_wrapper *wrapper = NULL;

ext/standard/iptc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ PHP_FUNCTION(iptcembed)
178178
size_t inx;
179179
zend_string *spoolbuf = NULL;
180180
unsigned char *poi = NULL;
181-
zend_stat_t sb;
181+
zend_stat_t sb = {0};
182182
bool written = 0;
183183

184184
ZEND_PARSE_PARAMETERS_START(2, 3)

ext/standard/link.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PHP_FUNCTION(linkinfo)
9494
char *link;
9595
char *dirname;
9696
size_t link_len;
97-
zend_stat_t sb;
97+
zend_stat_t sb = {0};
9898
int ret;
9999

100100
ZEND_PARSE_PARAMETERS_START(1, 1)

main/php_ini.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int php_init_config(void)
566566

567567
/* Check if php_ini_file_name is a file and can be opened */
568568
if (php_ini_file_name && php_ini_file_name[0]) {
569-
zend_stat_t statbuf;
569+
zend_stat_t statbuf = {0};
570570

571571
if (!VCWD_STAT(php_ini_file_name, &statbuf)) {
572572
if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
@@ -642,7 +642,7 @@ int php_init_config(void)
642642
if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
643643
struct dirent **namelist;
644644
int ndir, i;
645-
zend_stat_t sb;
645+
zend_stat_t sb = {0};
646646
char ini_file[MAXPATHLEN];
647647
char *p;
648648
zend_llist scanned_ini_list;

0 commit comments

Comments
 (0)