Merge pull request #539 from marcelwa/acd-uninit-bestperm

acd: uninitialised read of bestPerm in enumerate_iset_combinations
This commit is contained in:
alanminko 2026-08-16 01:47:52 +09:00 committed by GitHub
commit 25b0e5399c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -482,6 +482,11 @@ private:
for ( uint32_t i = 0; i < num_vars; ++i )
{
pComb[i] = pInvPerm[i] = i;
/* bestPerm is written only when some combination beats the initial
* best_cost. When none does, the loop below still evaluates
* permutations[bestPerm[i]], which reads uninitialised stack and then
* indexes permutations[] with it. Seed the identity permutation. */
bestPerm[i] = i;
}
/* early bail-out conditions */