fxamacker / cbor

CBOR codec (RFC 8949) with CBOR tags, Go struct tags (toarray, keyasint, omitempty), float64/32/16, big.Int, and fuzz tested billions of execs.
MIT License
748 stars 61 forks source link

Replace *errors.errorString with more specific error type for "inadmissible type for tag content" #551

Closed fxamacker closed 5 months ago

fxamacker commented 5 months ago

Currently *errors.errorString is returned when unmarshalling built-in tags (tag 0-3 and 21-23) with inadmissible content type.

It would be easier to check for this specific error (e.g. for fuzzing) if *errors.errorString is replaced by a more specific error type.

To help with backwards compatibility, we can keep the old error message the same.

See "Tag validity" in RFC 8949 Section 5.3.2 for more about "inadmissible type for tag content".