koinos / koinos-types

The Rosetta Stone of the Koinos ecosystem. Allows for the interpretation of Koinos data structures in a multitude of languages. Useful in the development of microservices, clients, and smart contracts.
MIT License
12 stars 3 forks source link

Check that all serialized data was used #206

Closed theoreticalbts closed 2 years ago

theoreticalbts commented 3 years ago

When deserializing, we should error if there were extra bytes at the end. We currently do not.

My suggestion is to add this check to any methods where length is known. In C++, that would be from_variable_blob, from_fixed_blob and from_c_str. The stream overrides shouldn't check the length, to allow them to continue to be used recursively as-is.