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

Uncaught Exception in Parser #60

GanbaruTobi opened this issue Feb 22, 2021 · 0 comments

Uncaught Exception in Parser #60

GanbaruTobi opened this issue Feb 22, 2021 · 0 comments


Copy link

@GanbaruTobi GanbaruTobi commented Feb 22, 2021

The parser fails to throw the ParseException when the parser expects the input to be of the float number type AND the input not being a valid number. This can lead to uncaught exceptions by unexpected input, which may lead to Denial-of-Service (DoS).

protected Number extractFloat() throws ParseException {
if (!acceptLeadinZero)
if (!useHiPrecisionFloat)
return Float.parseFloat(xs);
if (xs.length() > 18) // follow JSonIJ parsing method
return new BigDecimal(xs);
return Double.parseDouble(xs);

Parser Input of "-." or "2e+" or "[45e-" will crash with a NumberFormatException.

== Java Exception: java.lang.NumberFormatException: For input string: "-."
	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(
	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(
	at java.base/java.lang.Double.parseDouble(
	at net.minidev.json.parser.JSONParserBase.extractFloat(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant