Guard empty successful WMI enumeration batches - #132381
Open
jeffhandley with Copilot wants to merge 3 commits into
Open
Guard empty successful WMI enumeration batches#132381jeffhandley with Copilot wants to merge 3 commits into
jeffhandley with Copilot wants to merge 3 commits into
Conversation
|
Azure Pipelines: 16 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix potential null-deref in remote WMI enumeration
Guard empty successful WMI enumeration batches
Aug 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/libraries/System.Management/src/System/Management/ManagementObjectCollection.cs:586
- This change adds a new exception-throwing path for malformed WMI enumerators (success status with
cachedCount == 0), but there’s no regression test exercising this behavior. Without a test, it’s easy for future refactors to remove or change this guard and reintroduce the original null-deref scenario.
if (cachedCount == 0)
ManagementException.ThrowWithExtendedInfo(ManagementStatus.Timedout);
jeffhandley
reviewed
Aug 17, 2026
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/libraries/System.Management/src/System/Management/ManagementObjectCollection.cs:588
- The PR description (and the existing pattern in ManagementEventWatcher.cs:436-437) indicates this guard should throw a Timedout ManagementException for a successful fetch that returns 0 objects, but the implementation throws ManagementStatus.Failed here. Please reconcile (either update the PR description / issue rationale, or align the code with the Timedout behavior used elsewhere).
//A malformed enumerator can report success without returning any objects; treat this as a failure
//rather than silently proceeding with an empty cache.
if (cachedCount == 0)
ManagementException.ThrowWithExtendedInfo(ManagementStatus.Failed);
jeffhandley
approved these changes
Aug 17, 2026
jeffhandley
marked this pull request as ready for review
August 17, 2026 04:02
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
jeffhandley
enabled auto-merge (squash)
August 17, 2026 04:03
jeffhandley
disabled auto-merge
August 17, 2026 04:03
jeffhandley
enabled auto-merge (squash)
August 17, 2026 04:05
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-management |
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.
A malformed remote WMI enumerator can report success without returning an object, causing
Currentto dereference a null cache entry.ManagementExceptionfor zero-result successful batches after preserving timeout and normal end-of-enumeration handling.Note
This PR description was generated by AI/Copilot.