You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/php-src/Zend/zend_string.h:200:24: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:44:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_string.h:200:24
The output handler is supposed to get disabled on failure, and it does, by setting PHP_OUTPUT_HANDLER_DISABLED. So why is it still being called then...
Because this flag is checked neither in php_output_flush() nor in php_output_handler_op(). There is a respective guard in php_output_op() before calling php_output_handler_op(), but maybe that check should better be done in php_output_handler_op() itself.
Right.
Since we want to guard the user call and that php_output_handler_op already can return PHP_OUTPUT_HANDLER_FAILURE, I think the most logical place to put the check is in php_output_handler_op.
Activity
ndossche commentedon Jul 31, 2024
Simplified reproducer:
ndossche commentedon Jul 31, 2024
The output handler is supposed to get disabled on failure, and it does, by setting PHP_OUTPUT_HANDLER_DISABLED. So why is it still being called then...
cmb69 commentedon Jul 31, 2024
Because this flag is checked neither in
php_output_flush()nor inphp_output_handler_op(). There is a respective guard inphp_output_op()before callingphp_output_handler_op(), but maybe that check should better be done inphp_output_handler_op()itself.guard in php_output_flush()
outputs:
guard in php_output_handler_op()
outputs
PS: the guard needs to be negated, though.
ndossche commentedon Jul 31, 2024
Right.
Since we want to guard the user call and that
php_output_handler_opalready can return PHP_OUTPUT_HANDLER_FAILURE, I think the most logical place to put the check is inphp_output_handler_op.cmb69 commentedon Jul 31, 2024
I'll make a PR.
[-]Unexpected null pointer in Zend/zend_string.h[/-][+]Disabled output handler is flushed again[/+]Fix phpGH-15181: Disabled output handler is flushed again
Fix phpGH-15181: Disabled output handler is flushed again