Skip to content

Stack overflow when using Get-ChildItem on registry provider #10215

Closed

Description

@satorp

Steps to reproduce

Open PowerShell console with Administrator right, and type in the following commands.
The search item (here Installer) is irrelevant, also reproducible with wildcards.

cd HKLM:
dir -Recurse -Name -ErrorAction SilentlyContinue -Include Installer

Expected behavior

Get-ChildItem returns found registry subkeys.

Actual behavior

PowerShell crashes with StackOverflowException.

PS6-StackOverflowCrash

Environment data

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.2
PSEdition                      Core
GitCommitId                    6.2.2
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Notes

After further investigation I've come to the conclusion that the cause is a registry entry that has / as its name.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\PnpResources\Registry\HKLM\System\CurrentControlSet\Services\usbhub\/

This causes Get-ChildItem to recurse back to the root item endlessly and finally triggers stack overflow.

Not reproducible with non-administrative user rights due to the registry key's access permission disallows reading its child items.

Also reproducible with PS 5.1.

Activity

  1. added
    Issue-Question
    on Jul 23, 2019
  2. added
    WG-Engine-Providers
    and removed
    Issue-Question
    on Oct 13, 2019
  3. added
    WG-Engine-Performance
    Resolution-Duplicate
    and removed
    WG-Engine-Performance
    on Oct 13, 2019
  4. removed their assignment
    on Oct 14, 2019
  5. iSazonov commented on Oct 14, 2019

    @iSazonov
    Collaborator

    satorp Thanks for your report!

    It is dup #5536.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-DuplicateWG-Engine-Providers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions