-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Enable code analysis, sdl checks, binskim and fix related errors #856
Conversation
Misspellings found, please review:
To accept these changes, run the following commands from this repository on this branch
|
/azp run |
Pull request contains merge conflicts. |
/azp run |
Pull request contains merge conflicts. |
This reverts commit fb90335.
@@ -636,8 +636,8 @@ namespace AppInstaller::CLI::Workflow | |||
changes.size(), | |||
findByManifest.Matches.size(), | |||
packagesInBoth.size(), | |||
toLog ? static_cast<std::string_view>(toLog->GetProperty(PackageVersionProperty::Name)) : "", | |||
toLog ? static_cast<std::string_view>(toLog->GetProperty(PackageVersionProperty::Version)) : "", | |||
toLog ? static_cast<std::string>(toLog->GetProperty(PackageVersionProperty::Name)) : "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why here but not the two lines below? The difference is rvalue vs lvalue, but the lifetime of the rvalue is until the end of the statement. So converting to string_view is just as valid. This is either a mistake/overcaution in the analysis, or an error in my understanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code analysis error is C26449( https://docs.microsoft.com/en-us/cpp/code-quality/c26449?view=msvc-160 )
It specifically checks view created from temporary. It is most likely an overcaution because we immediately use the view within the statement. This is to make code analysis happy.
In reply to: 613644294 [](ancestors = 613644294)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ternary is confusing it, since that link specifically calls out:
Temporaries created for function call arguments are not flagged. It is safe to pass spans from such temporaries if target functions don’t retain data pointers in external variables.
Microsoft Reviewers: Open in CodeFlow