Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a heap-use-after-free in a unit test #7230

Merged

Conversation

sfc-gh-anoyes
Copy link
Collaborator

The data passed to IAsyncFile::write must remain valid until the future
is ready.

Code-Reviewer Section

The general guidelines can be found here.

Please check each of the following things and check all boxes before accepting a PR.

  • The PR has a description, explaining both the problem and the solution.
  • The description mentions which forms of testing were done and the testing seems reasonable.
  • Every function/class/actor that was touched is reasonably well documented.

For Release-Branches

If this PR is made against a release-branch, please also check the following:

  • This change/bugfix is a cherry-pick from the next younger branch (younger release-branch or main if this is the youngest branch)
  • There is a good reason why this PR needs to go into a release branch and this reason is documented (either in the description above or in a linked GitHub issue)

@sfc-gh-anoyes sfc-gh-anoyes requested a review from sfc-gh-bvr May 24, 2022 16:32
Comment on lines 2709 to 2710
state Standalone<StringRef> s = swVersionValue(swVersion);
ErrorOr<Void> e = wait(errorOr(newVersionFile->write(s.begin(), s.size(), 0)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment. We actually have holdWhile and holdWhileVoid actors to prevent object deconstruction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I think that would be an alternative to making s a state variable. I don't have a preference. @sfc-gh-xwang are you saying you prefer holdWhile to s being a state variable? Happy to make that change if so

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do keep it a state variable, I would recommend renaming it. We generally try to discourage short names for state variables because of shadowing risks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I prefer holdWhile. I just feel using state for a temp variables is somewhat too much, they don't need a lifetime as long as the outside actor.

@fdb-windows-ci
Copy link
Collaborator

Doxense CI Report for Windows 10

sfc-gh-bvr
sfc-gh-bvr previously approved these changes May 24, 2022
@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for Linux CentOS 7

  • CodeBuild project: foundationdb-pr
  • Commit ID: 7b2ebcc
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

sfc-gh-bvr
sfc-gh-bvr previously approved these changes May 24, 2022
@foundationdb-ci
Copy link
Contributor

AWS CodeBuild CI Report for macOS BigSur 11.5.2

  • CodeBuild project: foundationdb-pr-macos
  • Commit ID: d6dfce1
  • Result: SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@fdb-windows-ci
Copy link
Collaborator

Doxense CI Report for Windows 10

The data passed to IAsyncFile::write must remain valid until the future
is ready.
@fdb-windows-ci
Copy link
Collaborator

Doxense CI Report for Windows 10

@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr on Linux CentOS 7

  • Commit ID: edbb349
  • Duration 1:07:50
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Logs (available for 30 days)

@sfc-gh-anoyes sfc-gh-anoyes merged commit 1997e60 into apple:main Jun 7, 2022
@sfc-gh-anoyes sfc-gh-anoyes deleted the anoyes/fix-heap-use-after-free branch June 7, 2022 21:48
@foundationdb-ci
Copy link
Contributor

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

  • Commit ID: edbb349
  • Duration 4:17:01
  • Result: ❌ FAILED
  • Error: Build has timed out.
  • Build Logs (available for 30 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants