com-lihaoyi / upickle

uPickle: a simple, fast, dependency-free JSON & Binary (MessagePack) serialization library for Scala
https://com-lihaoyi.github.io/upickle
MIT License
706 stars 158 forks source link

Fix parsing of large integer doubles #504

Closed lihaoyi closed 12 months ago

lihaoyi commented 12 months ago

Fixes https://github.com/com-lihaoyi/upickle/issues/240

The basic problem appears to be that we are using a parseLong fast-path inside ujson.Value.visitFloat64StringParts. This is only valid for numbers of a certain digit-length. We should be checking for numbers larger than that length, and falling back to the toDouble slow path for those