Skip to content

rdar://131793235 (Invalid JSON string causes precondition failure) #754

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

Conversation

kperryua
Copy link
Contributor

Very large number values, like 100e200 are technically valid JSON, and so are not flagged by the parsing layer as invalid. When decoded as a Decimal, which cannot hold this value, we need a signal that differentiates that the value is too large compared to the input being unparseable. This allows JSONDecoder to throw the correct kind of error instead of hitting a fatal error.

This also generalizes the parsing implementation on Collection<UTF8.CodeUnit> so that JSONDecoder doesn't have to instantiate a throw-away String.

@kperryua kperryua requested a review from parkera July 22, 2024 17:44
@kperryua
Copy link
Contributor Author

@swift-ci test

@kperryua kperryua merged commit 944aead into swiftlang:main Jul 22, 2024
3 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