-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-17831: zend_test_compile_string crash on nul bytes check. #17832
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
Conversation
happens with unset script path, now using zend_str_has_nul_bytes thereafter.
ext/zend_test/test.c
Outdated
Z_PARAM_LONG(position) | ||
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
zend_op_array *op_array = NULL; | ||
|
||
if (zend_str_has_nul_byte(filename)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using PATH_STR makes this condition not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it seems PATH_STR does not do the check_null part. no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_null means checking for a NULL argument instead of a string, not for NUL bytes.
The bug here was that you passed 1 to check_null instead of 0. And passing 0 is equivalent to PATH_STR without the EX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah gotcha yes not the same thing at 2nd look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole reason we have PATH_STR is to check for NUL bytes in the string, that's the only difference with normal STR fast-ZPP
@@ -49,6 +49,7 @@ try { | |||
echo $e->getMessage(), PHP_EOL; | |||
} | |||
|
|||
zend_test_compile_string($x, $y, $z); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just pass NULLs to avoid the warning on undef var
happens with unset script path, now using zend_str_has_nul_bytes thereafter.