Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Jan 14, 2025

For the first child process execution, TWG(process) is NULL; we need to catch that to avoid undefined behavior.

@ndossche
Copy link
Member

Right, so no NULL access, but NULL arithmetic (which indeed is UB).
I think it's slightly better to wrap the for loops in TWG(process), at least it's clearer that way for me.

@cmb69 cmb69 marked this pull request as draft January 14, 2025 22:05
For the first child process execution, `TWG(process)` is `NULL`; we
need to catch that to avoid undefined behavior.
@cmb69 cmb69 force-pushed the cmb/process_get-null branch from 08fcb6d to 2d2150c Compare January 14, 2025 22:42
@cmb69 cmb69 changed the title Fix potential null pointer access during system program execution Fix NULL arithmetic during system program execution Jan 14, 2025
@cmb69
Copy link
Member Author

cmb69 commented Jan 14, 2025

I think it's slightly better to wrap the for loops in TWG(process), at least it's clearer that way for me.

Makes sense. Thank you! Done.

@cmb69 cmb69 marked this pull request as ready for review January 14, 2025 23:18
@cmb69 cmb69 closed this in 022a5fc Jan 15, 2025
@cmb69 cmb69 deleted the cmb/process_get-null branch January 15, 2025 21:56
charmitro pushed a commit to wasix-org/php that referenced this pull request Mar 13, 2025
For the first child process execution, `TWG(process)` is `NULL`; we
need to catch that to avoid undefined behavior.

Closes phpGH-17470.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants