swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

_CFXMLInterface: account for possible `nullptr` return #5082

Open compnerd opened 2 months ago

compnerd commented 2 months ago

xmlSplitQName2 may return nullptr for the result, which when passed to CFStringCreateWithCString would attempt to perform strlen(nullptr) which is ill-defined. When updating libxml2 on Windows, we would perform an invalid memory access due to the strlen invocation inside CFStringCreateWithCString. Protect against this case, returning NULL instead.

compnerd commented 2 months ago

@swift-ci please test

compnerd commented 2 months ago

CC: @jmschonfeld

compnerd commented 2 months ago

@swift-ci please test Windows platform

compnerd commented 2 months ago

@swift-ci please test

compnerd commented 2 months ago

@swift-ci please test windows platform