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

JSONObject and JSONArray initial flag for tokener may be flawed #944

Open
stleary opened this issue Jan 13, 2025 · 0 comments
Open

JSONObject and JSONArray initial flag for tokener may be flawed #944

stleary opened this issue Jan 13, 2025 · 0 comments

Comments

@stleary
Copy link
Owner

stleary commented Jan 13, 2025

From #927:

The boolean isInitial = x.getPrevious() == 0; check can behave in an unexpected way, for example:
JSONParserConfiguration strict = new JSONParserConfiguration().withStrictMode();
JSONTokener tok = new JSONTokener("[]xxx");
// Calling next+back changes "previous"; without these calls the check is performed:
tok.next();
tok.back();
JSONArray a1 = new JSONArray(tok, strict); // No error here, but should be because of extra chars?

This is a far corner case I think, but should be fixed if practical.
Is there a way to capture this in the JSONTokener object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant