Skip to content

PropertyListEncoder can create XML documents containing null bytes#2039

Merged
kperryua merged 1 commit into
swiftlang:release/6.4.xfrom
kperryua:rdar/168666413
Jun 15, 2026
Merged

PropertyListEncoder can create XML documents containing null bytes#2039
kperryua merged 1 commit into
swiftlang:release/6.4.xfrom
kperryua:rdar/168666413

Conversation

@kperryua

Copy link
Copy Markdown
Contributor

The XML spec explicitly forbids NUL bytes. We should prevent clients from being able to create XML property lists containing them.

Since this is a restriction of just XML, this prohibition should not apply to binary plists. As annoying as embedded NUL strings are when used without care, I think we're obligated to preserve them in places where they are not forbidden.

Also, in the spirit of "be liberal in what you accept, but strict in what you produce"—and to reduce the potential risk of this change—I'm not proposing any change to XML plist deserialization, which currently DOES accept NUL bytes.

@kperryua kperryua requested a review from a team as a code owner June 15, 2026 18:34
@kperryua

Copy link
Copy Markdown
Contributor Author

@swift-ci Please test

@kperryua kperryua changed the title CFPropertyListCreateData can create XML documents containing null bytes PropertyListEncoder can create XML documents containing null bytes Jun 15, 2026
@kperryua kperryua merged commit 76102ab into swiftlang:release/6.4.x Jun 15, 2026
24 checks passed
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