News for hackers. Stuff that matters.
Re:Son: A minimal subset of JSON for machine-to-machine comm... by d33 on Sunday December 10, 2017 @10:37AM (#15891838)
> What is the behaviour of a decoder that can't handle numeric types of that size?

Is this actually relevant? It sounds like an implementation detail to me and it seems to boil down to using arbitrary size bigint. If you can't handle a bigint because it's too big for your machine, it sounds like a problem with the system, not parser.

Re:Son: A minimal subset of JSON for machine-to-machine comm... by nly on Sunday December 10, 2017 @10:53AM (#15891915)
The behaviour of the encoder and decoder are just as important to specify as the bytes across the wire. This is the whole problem with JSON in the first place.
Re:Son: A minimal subset of JSON for machine-to-machine comm... by Spivak on Sunday December 10, 2017 @10:43AM (#15891873)
We can play this game all day. What if I pass an integer that takes 32GiB of memory to store? Also the system's fault if the resources aren't available?
Re:Son: A minimal subset of JSON for machine-to-machine comm... by d33 on Sunday December 10, 2017 @10:55AM (#15891918)
I'd say so. This is kind of a security question - the data is valid from the protocol's perspective, it's the contents that are malicious. It's up to the developer to decide how to handle that - if it's super important to be able to process such big numbers, modify the parser to handle that (for example by storing them on the HDD). Same goes for another serialization format: bencoding. It supports arbitrarily nested data structures and most implementations are recursive, which can easily result in stack overflow if you mess up the implementation. But I wouldn't blame the standard - that's the price you pay for flexibility. At the end of the day, you need to sanitize your input anyway and keep your edge cases in mind. Same goes with XML bombs...
Re:Son: A minimal subset of JSON for machine-to-machine comm... by rmrfrmrf on Sunday December 10, 2017 @03:13PM (#15893264)
I would think the JS part of JSON would preclude any massive integers. It’s still an IEEE floating point at the end of the day, so your max is (2^53)-1
Re:Son: A minimal subset of JSON for machine-to-machine comm... by bastawhiz on Sunday December 10, 2017 @03:15PM (#15893273)
If you managed to load a JSON string into memory that contains a number that takes 32GiB of memory to store after parsing, I don't think you're worrying much about resources.