Skip to content

ext/posix: posix_isatty() fix use-of-uninitialized-value #11676

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 2 commits into from
Jul 11, 2023

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jul 11, 2023

When the value passed is not representable as an int then it is not a TTY and thus should return false immediately. Moreover, we need to actually retrieve the zend_long from the zval.

This was reported by MSAN.

When the value passed is not representable as an int then it is not a TTY and thus should return false immediately.
Moreover, we need to actually retrieve the zend_long from the zval.

This was reported by MSAN.
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

}
fd = zval_get_long(z_fd);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this part looks redundant, no? fd is written to by zend_parse_arg_long, but only if successful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah indeed!

@Girgias Girgias merged commit 59f6d08 into php:master Jul 11, 2023
@Girgias Girgias deleted the posix-msan branch July 11, 2023 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants