Skip to content

Explicitly initialize object variables passed to Z_PARAM_OBJ_OF_CLASS_OR_LONG #13146

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

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Jan 14, 2024

I'm wondering whether we should explicitly initialize other similar variables passed to union type ZPP checks in order to prevent compiler miscompilations like the one for imagefontwidth? E.g. there are quite a few Z_PARAM_OBJ_OF_CLASS_OR_STR ZPP checks where an uninitialized object is passed.

Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

does not kill it to do so.

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

Does not hurt indeed. And if it is actually not necessary to zero them then the compiler will likely remove the zeroing anyway.

@kocsismate
Copy link
Member Author

I'm not exactly sure about the target branch. For now, master may be reasonable. If there is any issues in older branches then we can backport these fixes. I'm fine to do so now if you think it's a good idea. But anyway, I'm merging my changes for now.

@kocsismate kocsismate merged commit b5a23d8 into php:master Jan 14, 2024
@kocsismate kocsismate deleted the fix-another-uninitialized-gd-variable branch January 14, 2024 15:03
devnexen added a commit to devnexen/php-src that referenced this pull request Jan 14, 2024
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.

4 participants