Properties that have a fixed size (ie, integer types) generally use the check_size! macro to validate that the field size matches the expected size. For most other types, however, the length field is ignored. We should strive to validate that the read length always matches the property header's length field.
ArrayProperty::read offers a good example of validating complex properties using the validate! macro, which raises errors in case of condition failure.
Properties that have a fixed size (ie, integer types) generally use the
check_size!
macro to validate that the field size matches the expected size. For most other types, however, the length field is ignored. We should strive to validate that the read length always matches the property header's length field.ArrayProperty::read offers a good example of validating complex properties using the validate! macro, which raises errors in case of condition failure.