Skip to content

Fix GH-15661: Access null pointer in Zend/Optimizer/zend_inference.c #15666

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

Closed
wants to merge 2 commits into from

Conversation

nielsdos
Copy link
Member

No description provided.

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.

Do you have a test case?

There is one more ssa_op usage in zend_may_throw_ex(). It probably should be fixed as well.

@nielsdos
Copy link
Member Author

nielsdos commented Sep 6, 2024

Do you have a test case?

Added now, sorry for delay, real life got busy.
The issue title may be a bit confusing, it's pointer arithmetic on a NULL pointer, not a NULL dereference.

There is one more ssa_op usage in zend_may_throw_ex(). It probably should be fixed as well.

ssa_op will only be dereferenced if the type of op1 is inferred to only be MAY_BE_OBJECT. However, that can only happen in optimization level 3, but that level will not have ssa_op == NULL at that point of execution because it uses the SSA form to infer types. At least that's how I understand it, and I couldn't trigger a bug there by testing.

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.

Should this be fixed in PHP-8.2 as well?

@nielsdos nielsdos closed this in 86ef8d5 Sep 9, 2024
@nielsdos
Copy link
Member Author

nielsdos commented Sep 9, 2024

Should this be fixed in PHP-8.2 as well?

I think so. It applies cleanly on 8.2 and it's a minimal patch, so I'll apply it to 8.2 and up.

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.

Access null pointer in Zend/Optimizer/zend_inference.c
3 participants