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-14942] [SwiftTSC] JSONMessageStreamingParser can overflow the stack with large inputs #4403

Open
jakepetroules opened this issue Jul 20, 2021 · 0 comments
Labels

Comments

@jakepetroules
Copy link
Member

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

md5: 59ee1e5911b57c9cb9d9abefc22294f0

Issue Description:

The JSONMessageStreamingParser in swift-tools-support-core can overflow the stack with large inputs, due to the fact that the parseImpl method is recursive. This can occur with as little as ~3MB of streaming JSON text.

This should be easily reproducible by constructing a JSONMessageStreamingParser and feeding it a large amount of input in a single call to parse().

Clients may pre-split the input on newline (if possible), as a workaround for the overflow.

https://github.com/apple/swift-tools-support-core/blob/main/Sources/TSCUtility/JSONMessageStreamingParser.swift

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 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

2 participants