whyrusleeping / cbor-gen

Codegen for cbor codecs on your types
MIT License
35 stars 25 forks source link

Restrict indefinite-length data items #23

Closed schomatis closed 4 years ago

schomatis commented 4 years ago

The standard does not impose any restriction for these but we need a sane value that reflects the limitations of the implementation. Same for nested items.

Additionally any allocation should have a single point of entry where this restrictions is enforced.

This mostly concerns the Deferred type,

https://github.com/whyrusleeping/cbor-gen/blob/64967432584da50b86d78fc9bc343c7c7afa50d2/utils.go#L123

https://github.com/whyrusleeping/cbor-gen/blob/64967432584da50b86d78fc9bc343c7c7afa50d2/utils.go#L142-L144