-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Bug report: 'JSON beautify' operation losing numeric precision #415
Comments
DiscussionThis issue is arising due to the method of implementing the the beautification library being used. JSON SpecThe JSON Spec allows implementations to set precision limitations numbers. https://tools.ietf.org/html/rfc7159#section-6. ImplementationBeautification and minification are done with vkbeautify, which uses Javascript. Javascript numbers are all represented as a 64 bit float, with a 52 bit mantissa. So the safe range for integer usage is [-2^53,2^53] = [-9007199254740992,9007199254740992] As the spec allows for this behavior it might be better to classify this as a feature request instead of a bug. This bug also shows up in 'JSON Minify` as it uses vkbeautify. 'JSON Minify' Examplehttps://gchq.github.io/CyberChef/#recipe=JSON_Minify()&input=eyAiYSI6IDkwMDcxOTkyNTQ3NDA5OTMgfQ Input: Erroneous output: Other uses of vkbeautifyThis library gets used in the following locations. I believe that the JSON ones are the only ones that will have this particular issue as the others are likely not treating the represented numbers as anything other than a string.
|
Summary
When running the 'JSON beautify' operation, numeric precision is lost for large numbers.
Example
https://gchq.github.io/CyberChef/#recipe=JSON_Beautify('%5C%5Ct')&input=eyAiYSI6IDEyMzQ1Njc4OTAxMjM0NTY3ODkgfQ
Input:
Erroneous output:
The text was updated successfully, but these errors were encountered: