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

Add test for maximal nesting of arrays/objects #5

Open
nlohmann opened this issue Jul 25, 2020 · 3 comments
Open

Add test for maximal nesting of arrays/objects #5

nlohmann opened this issue Jul 25, 2020 · 3 comments

Comments

@nlohmann
Copy link

Almost all JSON parsers have limitations in the maximal nesting of arrays or objects. While

[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]

certainly will break no library any more, having the same input with a few thousand more [] will. It would be great to know the limits of the libraries.

@Loki-Astari
Copy link
Owner

I don't see much real value in this.
It's more of an implementation oddity on who can support the deepest nested array structure. In real life I would not expect to see 20 level nested array (or anything like that). IF you can support 20 levels you will be able to support any real life json objects that you find in the wild.

@nlohmann
Copy link
Author

I disagree that there is no value in it, because it is also a security issue if you can crash your parser with just a few bytes yielding a stack overflow.

@Loki-Astari
Copy link
Owner

OK. I sort of agree with that.

@Loki-Astari Loki-Astari reopened this Jul 29, 2020
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

No branches or pull requests

2 participants