UkoeHB / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
7 stars 4 forks source link

serialization: protect blob serialization from undefined behavior #33

Closed jeffro256 closed 8 months ago

jeffro256 commented 8 months ago

There is currently no compiler protection when someone tries to do (for example) BLOB_SERIALIZER(std::vector<int>). You just get runtime allocation errors. This has already eaten up dev time before, so this PR adds a static assertion that the type must be trivially copyable, as defined by the C++ standard. Types can override this if applicable if they use BLOB_SERIALIZER_FORCED.

UkoeHB commented 8 months ago

This PR is not specific to the seraphis library (only your current development on this branch). It should be moved to the monero repo.

jeffro256 commented 8 months ago

Fair enough