You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the JSONTokener::nextString() method, there are two lines of code (Line 258 and 261) that try to interpret Unicode characters which are represented with a 2-digit or 4-digit integer. The code missed the test rather the value of \u or \x is a valid integer to parse. If an invalid string is being passed in, the code will throw an unexpected NumberFormatException.
Just compile and run the proof of concept code could trigger the bug.
Suggested fix.
Add a checking of the possible values before parsing them to the Integer::parseInt(String)`` method, or catch the possible NumberFormatException and throw a unified JSONException by the syntaxError(String) method to avoid confusion to the user.
The text was updated successfully, but these errors were encountered:
Description of the bug.
In the
JSONTokener::nextString()
method, there are two lines of code (Line 258 and 261) that try to interpret Unicode characters which are represented with a 2-digit or 4-digit integer. The code missed the test rather the value of\u
or\x
is a valid integer to parse. If an invalid string is being passed in, the code will throw an unexpected NumberFormatException.Proof of Concept code that triggers the bug.
Just compile and run the proof of concept code could trigger the bug.
Suggested fix.
Add a checking of the possible values before parsing them to the Integer::parseInt(String)`` method, or catch the possible NumberFormatException and throw a unified JSONException by the
syntaxError(String)
method to avoid confusion to the user.The text was updated successfully, but these errors were encountered: