WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Fix incorrect memset call on an std::string

Open OneBlue opened this issue 6 months ago • 5 comments

Summary of the Pull Request

This pull request corrects an incorrect call to memset, writing zeroes in an std::string instead of simply calling clear()

PR Checklist

  • [X] Closes: Link to issue #xxx
  • [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [ ] Tests: Added/updated if needed and all pass
  • [ ] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated if needed
  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

This was originally caught by theoparis, see https://github.com/microsoft/WSL/discussions/12927

Validation Steps Performed

Ran the tests

OneBlue avatar May 28 '25 00:05 OneBlue

@OneBlue - looks like pipelines aren't getting triggered.

benhillis avatar May 28 '25 02:05 benhillis

@OneBlue - looks like pipelines aren't getting triggered.

Yeah I'm still working on it

OneBlue avatar May 28 '25 02:05 OneBlue

There is another similar compiler warning with memset probably.

src/linux/init/init.cpp:1075:12: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'struct _CREATE_PROCESS_PARSED' [-Wnontrivial-memcall]

Biswa96 avatar May 28 '25 05:05 Biswa96

There is another similar compiler warning with memset probably.

src/linux/init/init.cpp:1075:12: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'struct _CREATE_PROCESS_PARSED' [-Wnontrivial-memcall]

Yes this is similar, I'll take a look in a separate PR.

benhillis avatar May 28 '25 15:05 benhillis

There is another similar compiler warning with memset probably.

src/linux/init/init.cpp:1075:12: warning: first argument in call to 'memset' is a pointer to non-trivially copyable type 'struct _CREATE_PROCESS_PARSED' [-Wnontrivial-memcall]

Yes this is similar, I'll take a look in a separate PR.

Ended up adding it to this PR

OneBlue avatar Jun 10 '25 01:06 OneBlue