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

Check well-formedness of data from MarshalCBOR #485

Closed fxamacker closed 9 months ago

fxamacker commented 10 months ago

Closes #482

MarshalerError is returned if CBOR data item returned from MarshalCBOR() fails either:

Many thanks to @benluddy for reporting this bug! :+1:

fxamacker commented 9 months ago

@benluddy

Is that something you'd be interested in exploring (in a separate issue) in the future?

Yes, definitely! :+1:

The current API is meant to be easy for users familiar with encoding and encoding/json packages so it inherits some limitations from their interfaces.

A more efficient and extensible API would definitely be useful as an alternative to Marshaler. We'd be able to use EncMode, etc. and address various limitations you mentioned.