Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pike pike
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 107
    • Issues 107
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #10117

System.RegGetValue{,s} does not handle DWORD entries correctly.

src/modules/system/nt.c:push_regvalue() uses the wrong shifts for bytes other than the LSB:

    case REG_DWORD_LITTLE_ENDIAN:
      push_int(EXTRACT_UCHAR(buffer)+
               (EXTRACT_UCHAR(buffer+1)<<1)+
               (EXTRACT_UCHAR(buffer+2)<<2)+
               (EXTRACT_UCHAR(buffer+3)<<3));
      break;
      
    case REG_DWORD_BIG_ENDIAN:
      push_int(EXTRACT_UCHAR(buffer+3)+
               (EXTRACT_UCHAR(buffer+2)<<1)+
               (EXTRACT_UCHAR(buffer+1)<<2)+
               (EXTRACT_UCHAR(buffer)<<3));
      break;

Fortunately it seems like the most common DWORD entries in the registry are <= 255.

This bug has been there since the original implementation of System.RegGetValues() et al in commit 53bdc644 (src/modules/system/nt.c:1.18) in Pike 7.1.5.

Note that the bug is also present in Pike 7.0.318 and later due to a backport in commit 9481e19e (src/modules/system/nt.c:1.19).

The bug should be fixed in all relevant versions of Pike.

Assignee
Assign to
Time tracking