Skip to content

Commit a3d71d8

Browse files
authored
0 Initialize variables in the DlComplexityPathReceiver helper (flutter#194540)
DlComplexityPathReceiver in dl_complexity_helper.cc:32-35 did not initialize its line_verb_count, quad_verb_count, conic_verb_count, and cubic_verb_count fields, causing ComplexityCalculatorHelper::CalculatePathComplexity to read uninitialized stack memory when computing path complexity. In DisplayListComplexity.DrawShadow, removing BorderMaskBlur (flutter#194508) shifted symbol addresses in display_list_unittests such that the uninitialized stack values in Linux linux_unopt caused the computed complexity score for display_list_conic to wrap to 0, failing ASSERT_NE(calculator->Compute(display_list_conic.get()), 0u). Zero-initializing the verb counters should fix the bug. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
1 parent 2e53c3a commit a3d71d8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎engine/src/flutter/display_list/benchmarking/dl_complexity_helper.cc‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class DlComplexityPathReceiver : public flutter::DlPathReceiver {
2929
}
3030
void Close() override {}
3131

32-
uint32_t line_verb_count;
33-
uint32_t quad_verb_count;
34-
uint32_t conic_verb_count;
35-
uint32_t cubic_verb_count;
32+
uint32_t line_verb_count = 0u;
33+
uint32_t quad_verb_count = 0u;
34+
uint32_t conic_verb_count = 0u;
35+
uint32_t cubic_verb_count = 0u;
3636
};
3737

3838
} // namespace

0 commit comments

Comments
 (0)