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
{{ message }}
Repository navigation
zend_string_init with NULL pointer in simplexml (UB) #19988
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:191: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 /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_string.h:191:24 in
The problem is that the SimpleXMLElement is a document... Normally this isn't possible, i.e. it's always the root of a document that is pointed at, but xsl allows you to bypass this apparently. You can see this when you try importing a document via simplexml_import_dom.
A document indeed has no name.
Changing this to use the root element is breaking, and I see now technical reason why the importing of document nodes should be disallowed, so I'll just fix getName() probably.
Activity
ndossche commentedon Sep 29, 2025
Slightly reduced and easier:
ndossche commentedon Sep 29, 2025
Not sure why this is NULL in the first place, I'll have to figure it out. If it is legit that this is NULL then the following patch would work:
ndossche commentedon Sep 29, 2025
It's also not a SEGV, this does not crash my system but it's UB.
[-]SEGV zend_string.h unexpected null pointer[/-][+]zend_string_init with NULL pointer in simplexml (UB)[/+]ndossche commentedon Sep 29, 2025
It may also be worthwhile to use ZVAL_STRINGL_FAST as many tags tend to be one char.
ndossche commentedon Sep 29, 2025
The problem is that the SimpleXMLElement is a document... Normally this isn't possible, i.e. it's always the root of a document that is pointed at, but xsl allows you to bypass this apparently. You can see this when you try importing a document via simplexml_import_dom.
A document indeed has no name.
Changing this to use the root element is breaking, and I see now technical reason why the importing of document nodes should be disallowed, so I'll just fix getName() probably.
Fix phpGH-19988: zend_string_init with NULL pointer in simplexml (UB)
Fix GH-19988: zend_string_init with NULL pointer in simplexml (UB)
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5'