Skip to content

Fix off-by-one in PriorityBinding.InitializeClone#11420

Open
smolchanovsky wants to merge 1 commit intodotnet:mainfrom
smolchanovsky:fix-prioritybinding-clone
Open

Fix off-by-one in PriorityBinding.InitializeClone#11420
smolchanovsky wants to merge 1 commit intodotnet:mainfrom
smolchanovsky:fix-prioritybinding-clone

Conversation

@smolchanovsky
Copy link

@smolchanovsky smolchanovsky commented Feb 3, 2026

Index must be less than the size of _bindingCollection

Fixes #11419

Description

PriorityBinding.InitializeClone has the same off-by-one bug that was fixed for MultiBinding in #3220 / #3221.

The fix for MultiBinding changed i<=_bindingCollection.Count to i<_bindingCollection.Count, but the identical bug in PriorityBinding was not addressed.

Customer Impact

Low - the Clone method is internal. However, it may be called internally by WPF in certain scenarios

Regression

No. This bug has existed since the code was written. The same bug in MultiBinding was fixed in #3221, but PriorityBinding was not included in that fix

Testing

Manual testing

Risk

Low - trivial change

Microsoft Reviewers: Open in CodeFlow

Index must be less than the size of _bindingCollection

Fixes dotnet#11419
@smolchanovsky smolchanovsky requested a review from a team February 3, 2026 15:47
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Feb 3, 2026
Copy link
Member

@lindexi lindexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PriorityBinding.InitializeClone throws ArgumentOutOfRangeException

2 participants