Skip to content

[4.2] SR-8560: XMLDocument on Linux crashes with a Segmentation Fault #1887

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

Merged
merged 1 commit into from
Feb 8, 2019

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Feb 7, 2019

  • When returning an XMLNode, take a reference to the parent
    XMLDocument to prevent the underlying libxml xml document
    from being freed.

  • This prevents the document being freed if a reference is still
    held to a XMLNode but not the XMLDocument.

(cherry picked from commit aabed33)

- When returning an XMLNode, take a reference to the parent
  XMLDocument to prevent the underlying libxml xml document
  from being freed.

- This prevents the document being freed if a reference is still
  held to a XMLNode but not the XMLDocument.

(cherry picked from commit aabed33)
@spevans
Copy link
Contributor Author

spevans commented Feb 7, 2019

@swift-ci test 4.2

@spevans
Copy link
Contributor Author

spevans commented Feb 7, 2019

@kevints Another XML crash fix.

<plans></plans>
"""

let data = str.data(using: .utf8)!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter for this PR, but let data = Data(str.utf8) is nicer as there's no optional involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely need a cleanup of the tests in master at some point.

@kevints
Copy link
Contributor

kevints commented Feb 8, 2019

Thanks @spevans!

@swift-ci test and merge

@swift-ci swift-ci merged commit 5105e59 into swiftlang:swift-4.2-branch Feb 8, 2019
adam-fowler added a commit to adam-fowler/soto-core that referenced this pull request Jul 2, 2019
- This fixes a crash most likely related to swiftlang/swift-corelibs-foundation#1887
We need to ensure we hold a reference to the XMLDocument if we are processing XMLNodes inside it. I've done this by allowing Body to hold an XMLDocument
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.

4 participants