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-13546] XMLParser is not reentrance safe. #3942

Open
dhoepfl opened this issue Sep 13, 2020 · 2 comments
Open

[SR-13546] XMLParser is not reentrance safe. #3942

dhoepfl opened this issue Sep 13, 2020 · 2 comments
Labels

Comments

@dhoepfl
Copy link
Contributor

dhoepfl commented Sep 13, 2020

Previous ID SR-13546
Radar None
Original Reporter @dhoepfl
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: b784a0a3dab8bc2d51d040e1b1b8d50b

Issue Description:

As @millenomi noticed in the review of pull #2877, the implementation of XMLParser is not reentrant.

Currently (before and after pull 2877), the XMLParser instance used for SAX callbacks is stored as a thread local object. After parsing, the object is reset to NULL. Thus, if any of the callbacks creates its own instance of XMLParser and parses XML data, the “current“ instance is reset to NULL after the end of this callback. Since the SAX run of the original parser might trigger subsequent callback calls, these calls loose the connection to their “current“ parser instance.

I see several potential fixes for this problem but did not have the time to analyze it in detail:

  • Reset the previous XMLParser instead of setting to NULL.

  • Replace the “current XMLParser“ by a stack of parsers.

  • Change the CFXMLParser-Interface to include the XMLParser as user info

@dhoepfl
Copy link
Contributor Author

dhoepfl commented Sep 16, 2020

Blocks SR-2301

@dhoepfl
Copy link
Contributor Author

dhoepfl commented Nov 10, 2020

Fixed in pull request #2920.

@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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant