Bug: decoding CBOR byte string into time.Time
is allowed if decoding option DefaultByteStringType
is set to reflect.TypeOf("")
#501
Labels
bug
Something isn't working
DefaultByteStringType
is a new decoding option that was recently added in v2.6.0.Setting decoding option
DefaultByteStringType
toreflect.TypeOf("")
causes unintended side effect of allowing CBOR byte string to be decoded intotime.Time
. Although decoding CBOR byte string intotime.Time
is a requested feature, it should not be allowed by a side effect.Specifically,
parse()
decodes CBOR byte string into Go string if decoding optionDefaultByteStringType
is set toreflect.TypeOf("")
.parseToTime()
converts decoded Go value fromparse()
totime.Time
, so CBOR byte string is decoded to Go string, which is then converted totime.Time
.This side effect is from implementation details and is not intended.
DefaultByteStringType
should be limited to its documented use.Thanks @benluddy for initial discussion about this at #497. 👍
The text was updated successfully, but these errors were encountered: