Skip to content
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

[SR-9419] XMLDocument constructor crashes (SIGSEGV) when passed empty string #3579

Open
swift-ci opened this issue Dec 6, 2018 · 0 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Dec 6, 2018

Previous ID SR-9419
Radar None
Original Reporter TaborKelly (JIRA User)
Type Bug
Environment

Ubuntu 18.04 (amd64) running Swift 4.2 release.

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: ea5cdd9c25750dcd3f688acf99843424

Issue Description:

The XMLDocument crashes (SIGSEGV) when passed empty string. I have created a repository that easily reproduces the issue here:
https://github.com/TaborKelly/XMLDocument

The backtrace from lldb is as follows:

(lldb) bt
* thread #​1, name = 'XMLDocument', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #​0: 0x00007ffff7285b60 libFoundation.so`_CFXMLNodeGetPrivateData
    frame #​1: 0x00007ffff763507e libFoundation.so`Foundation.XMLNode.init(ptr: Swift.UnsafeMutableRawPointer) -> Foundation.XMLNode + 94
    frame #&#8203;2: 0x00007ffff7628317 libFoundation.so`function signature specialization <Arg[0] = Exploded> of Foundation.XMLDocument.init(data: Foundation.Data, options: Foundation.XMLNode.Options) throws -> Foundation.XMLDocument + 103
    frame #&#8203;3: 0x00007ffff76284e6 libFoundation.so`function signature specialization <Arg[0] = Exploded> of Foundation.XMLDocument.init(xmlString: Swift.String, options: Foundation.XMLNode.Options) throws -> Foundation.XMLDocument + 166
    frame #&#8203;4: 0x00007ffff7625512 libFoundation.so`Foundation.XMLDocument.__allocating_init(xmlString: Swift.String, options: Foundation.XMLNode.Options) throws -> Foundation.XMLDocument + 66
    frame #&#8203;5: 0x00005555555566b3 XMLDocument`parseData(fromString="") at XMLDocument.swift:9
    frame #&#8203;6: 0x0000555555555f51 XMLDocument`main at main.swift:8
    frame #&#8203;7: 0x00007ffff5cdeb97 libc.so.6`__libc_start_main(main=(XMLDocument`main at main.swift), argc=1, argv=0x00007fffffffdf88, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffdf78) at libc-start.c:310
    frame #&#8203;8: 0x0000555555555caa XMLDocument`_start + 42

This does not crash on Mac OS.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant