Skip to content

Fix some MSAN complaints under Clang #8553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void zend_stream_stdio_closer(void *handle) /* {{{ */

static size_t zend_stream_stdio_fsizer(void *handle) /* {{{ */
{
zend_stat_t buf;
zend_stat_t buf = {0};
if (handle && zend_fstat(fileno((FILE*)handle), &buf) == 0) {
#ifdef S_ISREG
if (!S_ISREG(buf.st_mode)) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_virtual_cwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
do { free(pathw); } while(0);

#else
zend_stat_t st;
zend_stat_t st = {0};
#endif
realpath_cache_bucket *bucket;
char *tmp;
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ static accel_time_t zend_get_file_handle_timestamp_win(zend_file_handle *file_ha

accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size)
{
zend_stat_t statbuf;
zend_stat_t statbuf = {0};
#ifdef ZEND_WIN32
accel_time_t res;
#endif
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static ZEND_INI_MH(OnUpdateFileCache)
if (!ZSTR_LEN(new_value)) {
new_value = NULL;
} else {
zend_stat_t buf;
zend_stat_t buf = {0};

if (!IS_ABSOLUTE_PATH(ZSTR_VAL(new_value), ZSTR_LEN(new_value)) ||
zend_stat(ZSTR_VAL(new_value), &buf) != 0 ||
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ PHP_FUNCTION(glob)
* able to filter directories out.
*/
if (flags & GLOB_ONLYDIR) {
zend_stat_t s;
zend_stat_t s = {0};

if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) {
continue;
Expand Down
10 changes: 5 additions & 5 deletions ext/standard/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static void _php_dns_free_res(struct __res_state *res) { /* {{{ */
PHP_FUNCTION(dns_check_record)
{
HEADER *hp;
querybuf answer;
querybuf answer = {0};
char *hostname;
size_t hostname_len;
zend_string *rectype = NULL;
Expand Down Expand Up @@ -470,7 +470,7 @@ static u_char *php_parserr(u_char *cp, u_char *end, querybuf *answer, int type_t
long n, i;
u_short s;
u_char *tp, *p;
char name[MAXHOSTNAMELEN];
char name[MAXHOSTNAMELEN] = {0};
int have_v6_break = 0, in_v6_break = 0;

ZVAL_UNDEF(subarray);
Expand Down Expand Up @@ -839,7 +839,7 @@ PHP_FUNCTION(dns_get_record)
struct __res_state *handle = &state;
#endif
HEADER *hp;
querybuf answer;
querybuf answer = {0};
u_char *cp = NULL, *end = NULL;
int n, qd, an, ns = 0, ar = 0;
int type, first_query = 1, store_results = 1;
Expand Down Expand Up @@ -1069,8 +1069,8 @@ PHP_FUNCTION(dns_get_mx)
zval *mx_list, *weight_list = NULL;
int count, qdc;
u_short type, weight;
querybuf answer;
char buf[MAXHOSTNAMELEN];
querybuf answer = {0};
char buf[MAXHOSTNAMELEN] = {0};
HEADER *hp;
u_char *cp, *end;
int i;
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/filestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ PHP_FUNCTION(clearstatcache)
/* {{{ php_stat */
PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
{
zend_stat_t *stat_sb;
php_stream_statbuf ssb;
zend_stat_t *stat_sb = {0};
php_stream_statbuf ssb = {0};
int flags = 0, rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
const char *local = NULL;
php_stream_wrapper *wrapper = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/iptc.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ PHP_FUNCTION(iptcembed)
size_t inx;
zend_string *spoolbuf = NULL;
unsigned char *poi = NULL;
zend_stat_t sb;
zend_stat_t sb = {0};
bool written = 0;

ZEND_PARSE_PARAMETERS_START(2, 3)
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ PHP_FUNCTION(linkinfo)
char *link;
char *dirname;
size_t link_len;
zend_stat_t sb;
zend_stat_t sb = {0};
int ret;

ZEND_PARSE_PARAMETERS_START(1, 1)
Expand Down
4 changes: 2 additions & 2 deletions main/php_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ int php_init_config(void)

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

if (!VCWD_STAT(php_ini_file_name, &statbuf)) {
if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
Expand Down Expand Up @@ -642,7 +642,7 @@ int php_init_config(void)
if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
struct dirent **namelist;
int ndir, i;
zend_stat_t sb;
zend_stat_t sb = {0};
char ini_file[MAXPATHLEN];
char *p;
zend_llist scanned_ini_list;
Expand Down