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

Scientific notation numbers potentially break when not converted to the right type #256

Open
legopiraat opened this issue Apr 19, 2018 · 0 comments

Comments

@legopiraat
Copy link

Hello,

When i was testing my application i noticed when you send a scientific notation number in the json and convert it to a Long the calculation takes very long and uses all the CPU.

example:

  case class ScientificNotation(number: Long)
  implicit val testJsonFormat: RootJsonFormat[ScientificNotation] = jsonFormat1(ScientificNotation)

  "it should break" when {
    "a scientific number is parsed as long" in {
      val json = s"""{ "number": 1e100000000 }"""

      json.parseJson.convertTo[ScientificNotation]
    }
  }

This will a big calculation and will use up all CPU. When used in an API this could potentially DDos the application really easy.

Regards,
Legopiraat

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

1 participant