Skip to content

Add sanitity checks regarding num_args and arg_info #16538

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
Oct 25, 2024

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Oct 21, 2024

num_args > 0 implies that arg_info != NULL. We explicitly assert that during compilation and execution to make it easier for developers to not miss this[1].

[1] #16266

`num_args > 0` implies that `arg_info != NULL`.  We explicitly assert
that during compilation and execution to make it easier for developers
to not miss this[1].

[1] <php#16266>
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

This looks OK.

On the other hand termination because of assertion is only slightly better than the crash because of NULL dereference. Both cases need to be caught in debugger to identify the buggy function.

@cmb69 cmb69 merged commit 91e6f26 into php:master Oct 25, 2024
10 checks passed
@cmb69 cmb69 deleted the cmb/num_args-arg_info branch October 25, 2024 13:54
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