diff options
author | Colin Cross <ccross@android.com> | 2018-12-19 22:55:15 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-12-19 23:04:42 -0800 |
commit | b9e195546ee80e46fca5e075c9b1ea069821f18a (patch) | |
tree | 67facfdda4183f890cd01858d5b2277cf3047b5f /tools/incident_section_gen/main.cpp | |
parent | 90c5bfe0776fe185abaf2fc983f5320cb9d6a78f (diff) |
Use vector instead of VLA to avoid uninitialized values
I502b34f23d61a7346d79ff0dc378add8461d2d27 added a continue before
skip[i] was set, which left it uninitialized and caused
non-deterministic output of incident-section-gen incidentd and a
non-deterministic incidentd binary. Use a vector instead of a
variable length array for skip so that it is always initialized.
Test: valgrind incident-section-gen incidentd
Change-Id: Iac9778dc8bbf4ec5540e5e2ffdaa8e2dd852d6cc
Diffstat (limited to 'tools/incident_section_gen/main.cpp')
-rw-r--r-- | tools/incident_section_gen/main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp index faa354788c4e..f6c9c0e86fe4 100644 --- a/tools/incident_section_gen/main.cpp +++ b/tools/incident_section_gen/main.cpp @@ -453,7 +453,7 @@ static bool generateSectionListCpp(Descriptor const* descriptor) { map<string, bool> variableNames; set<string> parents; vector<const FieldDescriptor*> fieldsInOrder = sortFields(descriptor); - bool skip[fieldsInOrder.size()]; + vector<bool> skip(fieldsInOrder.size()); const Destination incidentDest = getPrivacyFlags(descriptor).dest(); for (size_t i=0; i<fieldsInOrder.size(); i++) { |