Skip to content

Commit 2ecd46f

Browse files
committed
Initialise zend_stat_t to fix MSAN build
1 parent cc506a8 commit 2ecd46f

File tree

17 files changed

+29
-29
lines changed

17 files changed

+29
-29
lines changed

Zend/zend_virtual_cwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static cwd_state main_cwd_state; /* True global */
120120

121121
static int php_is_dir_ok(const cwd_state *state) /* {{{ */
122122
{
123-
zend_stat_t buf;
123+
zend_stat_t buf = {0};
124124

125125
if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode))
126126
return (0);
@@ -131,7 +131,7 @@ static int php_is_dir_ok(const cwd_state *state) /* {{{ */
131131

132132
static int php_is_file_ok(const cwd_state *state) /* {{{ */
133133
{
134-
zend_stat_t buf;
134+
zend_stat_t buf = {0};
135135

136136
if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode))
137137
return (0);

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4376,7 +4376,7 @@ static bool exif_discard_imageinfo(image_info_type *ImageInfo)
43764376
static bool exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
43774377
{
43784378
bool ret;
4379-
zend_stat_t st;
4379+
zend_stat_t st = {0};
43804380

43814381
/* Start with an empty image information structure. */
43824382
memset(ImageInfo, 0, sizeof(*ImageInfo));

ext/fileinfo/libmagic/apprentice.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
11871187
continue;
11881188
}
11891189
if ((*bang[i].fun)(ms, &me,
1190-
line + bang[i].len + 2,
1190+
line + bang[i].len + 2,
11911191
len - bang[i].len - 2) != 0) {
11921192
(*errs)++;
11931193
continue;
@@ -1324,7 +1324,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
13241324
uint32_t i, j;
13251325
size_t files = 0, maxfiles = 0;
13261326
char **filearr = NULL;
1327-
zend_stat_t st;
1327+
zend_stat_t st = {0};
13281328
struct magic_map *map;
13291329
struct magic_entry_set mset[MAGIC_SETS];
13301330
php_stream *dir;
@@ -1419,7 +1419,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
14191419
/* coalesce per file arrays into a single one, if needed */
14201420
if (mset[j].count == 0)
14211421
continue;
1422-
1422+
14231423
if (coalesce_entries(ms, mset[j].me, mset[j].count,
14241424
&map->magic[j], &map->nmagic[j]) == -1) {
14251425
errs++;

ext/fileinfo/libmagic/magic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream)
188188
{
189189
int rv = -1;
190190
unsigned char *buf;
191-
zend_stat_t sb;
191+
zend_stat_t sb = {0};
192192
ssize_t nbytes = 0; /* number of bytes read from a datafile */
193193
int no_in_stream = 0;
194194

ext/openssl/openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist)
23642364
X509_LOOKUP * dir_lookup, * file_lookup;
23652365
int ndirs = 0, nfiles = 0;
23662366
zval * item;
2367-
zend_stat_t sb;
2367+
zend_stat_t sb = {0};
23682368

23692369
store = X509_STORE_new();
23702370

ext/session/mod_files.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime)
283283
{
284284
DIR *dir;
285285
struct dirent *entry;
286-
zend_stat_t sbuf;
286+
zend_stat_t sbuf = {0};
287287
char buf[MAXPATHLEN];
288288
time_t now;
289289
int nrdels = 0;
@@ -340,7 +340,7 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime)
340340
static int ps_files_key_exists(ps_files *data, const char *key)
341341
{
342342
char buf[MAXPATHLEN];
343-
zend_stat_t sbuf;
343+
zend_stat_t sbuf = {0};
344344

345345
if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) {
346346
return FAILURE;
@@ -473,7 +473,7 @@ PS_CLOSE_FUNC(files)
473473
PS_READ_FUNC(files)
474474
{
475475
zend_long n = 0;
476-
zend_stat_t sbuf;
476+
zend_stat_t sbuf = {0};
477477
PS_FILES_DATA;
478478

479479
ps_files_open(data, ZSTR_VAL(key));

ext/session/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */
11531153
static inline void last_modified(void) /* {{{ */
11541154
{
11551155
const char *path;
1156-
zend_stat_t sb;
1156+
zend_stat_t sb = {0};
11571157
char buf[MAX_STR + 1];
11581158

11591159
path = SG(request_info).path_translated;

ext/standard/pageinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
/* {{{ php_statpage */
5151
PHPAPI void php_statpage(void)
5252
{
53-
zend_stat_t *pstat;
53+
zend_stat_t *pstat = {0};
5454

5555
pstat = sapi_get_stat();
5656

ext/standard/php_fopen_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
392392

393393
#if defined(S_IFSOCK) && !defined(PHP_WIN32)
394394
do {
395-
zend_stat_t st;
395+
zend_stat_t st = {0};
396396
memset(&st, 0, sizeof(st));
397397
if (zend_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
398398
stream = php_stream_sock_open_from_socket(fd, NULL);

ext/xmlwriter/php_xmlwriter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
155155
dir_len = php_dirname(file_dirname, strlen(source));
156156

157157
if (dir_len > 0) {
158-
zend_stat_t buf;
158+
zend_stat_t buf = {0};
159159
if (php_sys_stat(file_dirname, &buf) != 0) {
160160
xmlFreeURI(uri);
161161
return NULL;

0 commit comments

Comments
 (0)