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

Init a JSONArray with "[" will induce StackOverflowError in version 20171018. #388

Closed
yaosiang opened this issue Dec 18, 2017 · 2 comments
Closed

Comments

@yaosiang
Copy link

When I upgrade org.json from 20170516 to 20171018, my unit test begin to failed, the test case shows if I init a JSONArray with "[", it will induce StackOverflowError.

new JSONArray("[");

The call stack shows a infinite loop between JSONTokener.nextValue and JSONArray.<init>

Exception in thread "main" java.lang.StackOverflowError
	at org.json.JSONTokener.back(JSONTokener.java:109)
	at org.json.JSONTokener.nextValue(JSONTokener.java:433)
	at org.json.JSONArray.<init>(JSONArray.java:118)
	at org.json.JSONTokener.nextValue(JSONTokener.java:434)
	at org.json.JSONArray.<init>(JSONArray.java:118)
	at org.json.JSONTokener.nextValue(JSONTokener.java:434)
	at org.json.JSONArray.<init>(JSONArray.java:118)
	at org.json.JSONTokener.nextValue(JSONTokener.java:434)
	at org.json.JSONArray.<init>(JSONArray.java:118)
	at org.json.JSONTokener.nextValue(JSONTokener.java:434)
	at org.json.JSONArray.<init>(JSONArray.java:118)
        ... skip
@johnjaylward
Copy link
Contributor

This was fixed in #373

@yaosiang
Copy link
Author

Got it. Hope this fix will release soon :)

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