-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure all fields in cluster-objects structs are default-initialized. (…
…#13432) Otherwise we can end up reading random values from un-initialized memory (e.g. if a mandatory command/struct/event field is not sent by the other side). Fixes #10271
- Loading branch information
1 parent
7bdf8bc
commit 5c00c32
Showing
6 changed files
with
2,417 additions
and
2,349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/app/zap-templates/partials/cluster-objects-field-init.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{! For now, just initialize fields to type defaults. Longer-term, we | ||
may want to use spec-defined default values here. }} | ||
{{#unless isOptional}} {{! Optionals inited by constructor }} | ||
{{~#unless isNullable}} {{! Nullables inited by constructor }} | ||
{{~#unless isArray}} {{! DataModel lists inited by constructor }} | ||
{{~#unless entryType}} {{! DataModel lists (for attributes) inited by constructor }} | ||
{{~#unless (isString type)}} {{! Strings are Spans, inited by constructor }} | ||
{{~#if_is_struct type}} | ||
{{! Structs have their own initializers }} | ||
{{~else~}} | ||
= static_cast<{{zapTypeToEncodableClusterObjectType type}}>(0) | ||
{{~/if_is_struct}} | ||
{{~/unless}} | ||
{{~/unless}} | ||
{{~/unless}} | ||
{{~/unless}} | ||
{{~/unless}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.