You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For an application whose CBOR-based protocol does not include arbitrary-precision integers (https://www.rfc-editor.org/rfc/rfc8949.html#section-5-3), it should be possible to reject the bignum tags 2 and 3 on decode and math/big.Int on encode.
Describe the solution you'd like
A new decode option specifying the decode behavior for the bignum tags, regardless of the Go type of the unmarshal destination object. Its default value would be backwards-compatible and would permit the bignum tag, but its second mode will cause Wellformed and Unmarshal to return an UnacceptableDataItemError if a bignum tag is encountered.
The existing BigIntDec option is scoped to unmarshaling bignums into interface{}, which would not be suitable on its own for the purpose of rejecting all bignums. Bignums can also be decoded into uint, int, float, slice, array, and math/big.Int. I ended up adding the new option because I did not see a use case where the type of the destination Go value would affect whether or not a CBOR-based protocol accepts a particular input.
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
For an application whose CBOR-based protocol does not include arbitrary-precision integers (https://www.rfc-editor.org/rfc/rfc8949.html#section-5-3), it should be possible to reject the bignum tags 2 and 3 on decode and
math/big.Int
on encode.Describe the solution you'd like
UnacceptableDataItemError
if a bignum tag is encountered.BigIntConvert
, analogous to theInfConvert
andNaNConvert
options introduced by Allow rejection of NaN and Inf float values on encode and decode. #513, that will return anUnsupportedTypeError
if amath/big.Int
is passed to Marshal.Describe alternatives you've considered
The existing
BigIntDec
option is scoped to unmarshaling bignums intointerface{}
, which would not be suitable on its own for the purpose of rejecting all bignums. Bignums can also be decoded into uint, int, float, slice, array, andmath/big.Int
. I ended up adding the new option because I did not see a use case where the type of the destination Go value would affect whether or not a CBOR-based protocol accepts a particular input.Additional context
The text was updated successfully, but these errors were encountered: