You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normal Zig structs and unions do not guarantee size or field order. Zig is allowed to insert secret fields. So, for every normal struct that the code does a @ptrCast to or a @fieldParentPtr, insert a secret first field which has 4 bytes generated unique identifier for the type. When we do the cast, verify the id.
Debug safety that makes structs/unions bigger can be disabled with @setRuntimeSafety(false) in a comptime block directly inside a struct. Once #978 is implemented it would be @optimizeFor(.Small).
Of course, these protections are disabled by default in release-fast and release-small modes.
The text was updated successfully, but these errors were encountered:
andrewrk
added
the
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
label
Jun 15, 2018
Normal Zig structs and unions do not guarantee size or field order. Zig is allowed to insert secret fields. So, for every normal struct that the code does a
@ptrCast
to or a@fieldParentPtr
, insert a secret first field which has 4 bytes generated unique identifier for the type. When we do the cast, verify the id.Debug safety that makes structs/unions bigger can be disabled with
@setRuntimeSafety(false)
in acomptime
block directly inside a struct. Once #978 is implemented it would be@optimizeFor(.Small)
.Of course, these protections are disabled by default in release-fast and release-small modes.
The text was updated successfully, but these errors were encountered: