Closed PJK closed 7 years ago
Oh, Array.new(2**63) throws an exception in Ruby (the wrong one, by the way). That's the internal server error you should be seeing; I need to catch that exception. What did you expect to get?
What did you expect to get?
I'd say an error explaining what went wrong, to make it consistent with error handling for other invalid inputs. For example, if I try converting xx
, I get Out of bytes to decode: 1
.
Note that in principle this CBOR fragment is not invalid because of the size being unrealistically high, but because it is not followed by the expected number of bytes. Thus if you decide to show something along the lines of bignum too big to convert into
long' (RangeError)` (I understand that the webapp is based on the gem?), it should clearly say that this indicates a limitation of the implementation, not the actual problem with the input.
Indeed, I shouldn't even try to allocate the array of size x unless there are at least x bytes of input left. Will be in 0.2.4.
Fixed in https://github.com/cabo/cbor-diag/commit/3d322ccb50bd6fb73013bd162d76000c90be9508 -- now running on http://cbor.me
The following sequence is not correctly handled:
(Also see PJK/libcbor#16)