BlackToppStudios / Mezz_Foundation

Foundational Data types that enforce no opinions on how to build games and provide many facilities that complex games need. This largely avoids graphics and physics, but provides tools like the SortedVector, CountedPtr and HashedString classes.
GNU General Public License v3.0
3 stars 0 forks source link

Feature-Introspection #54

Closed MakoEnergy closed 5 years ago

MakoEnergy commented 5 years ago

The introspection system is designed to be a fast and efficient template metaprogramming means of retrieving and assigning values on arbitrary types. This is meant to be the bases of value access for the serialization system.

Sqeaky commented 5 years ago

The function EnumBit with 0 as a parameter results in a temporary that holds UINT_MAX (because 0-1 == UINT_MAX) which is then used to as the amount to bitshift a 1 that many times which is Undefined Behavior.for amounts larger than the size of the UInt64, which UINT_MAX probably is.

This function ought to have range checks (or something) to prevent this UB.

EDIT - Could this be detected by a template?

EDIT 2 - I misread that conditional pretty hard.