Repository navigation
Skip folded and moved results when folding non-primary matches - #6
Closed
Tom Plant (pl4nty) wants to merge 2 commits into
Closed
Tom Plant (pl4nty) wants to merge 2 commits into
Tom Plant (pl4nty) wants to merge 2 commits into
Conversation
FoldResults could pick a candidate index whose result had already been folded into a primary match, dereferencing its null Package. It could also pick an index that a later primary result had been moved into, folding the tracked package into an unrelated result. Fixes microsoft#6624 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GS4h7Zmyh2QsoqHXHARQjX
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GS4h7Zmyh2QsoqHXHARQjX
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📖 Description
FoldResultsbuilds its candidate list fromNonPrimaryPackageIndices. Those lists aren't updated after the folds, so they can point at stale entries:Package. It's still a candidate for its other available packages, so a later entry dereferences it and crashes (c0000005).winget listshows a wrong result.This PR skips both kinds of candidate when filtering
candidateMatches.🔗 References
Fixes microsoft#6624
Originally reported by KarbitsCode (@KarbitsCode) in pl4nty/winget-extras#2428
🔍 Validation
Added
CompositeSource_SxS_FoldedResultIsNonPrimaryCandidate, which follows the repro in the issue. It has one section for each order: the tracked result first (the crash), and the tracked result moved forward (the wrong fold).Before the fix (Debug x64, test only):
After the fix:
✅ Checklist
🤖 AI Assistance
📋 Issue Type
Generated by Claude Code