Skip to content

[6.0] [stdlib] Ignore argc when setting up CommandLine.arguments #74913

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

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

Azoy
Copy link
Contributor

@Azoy Azoy commented Jul 2, 2024

This is a cherry pick of #74739

  • Explanation: Previously, we were using the result of _swift_stdlib_getUnsafeArgvArgc for both argv and argc as our source of truth. This is a fair assumption, but these values are globally mutable on some platforms so argc may not indicate the actual number of values within argv. Handle this by iterating argv ourselves to figure out what argc really is to prevent attempting to read outside of our bounds.
  • Scope: Stdlib, CommandLine.arguments and CommandLine.argc
  • Risk: Low
  • Testing: NA
  • Issue: rdar://130346225 & rdar://129708138
  • Reviewer: @parkera
  • Main branch PR: [stdlib] Ignore argc when setting up CommandLine.arguments #74739

[stdlib] Ignore argc when setting up CommandLine.arguments
@Azoy Azoy requested a review from a team as a code owner July 2, 2024 21:32
@Azoy
Copy link
Contributor Author

Azoy commented Jul 2, 2024

@swift-ci please test

@stephentyrone
Copy link
Contributor

Filed under "doctor, it hurts when I do this!"

@Azoy Azoy merged commit 5682a1f into swiftlang:release/6.0 Jul 3, 2024
5 checks passed
@Azoy Azoy deleted the 60-argc branch July 3, 2024 16:44
@saagarjha
Copy link
Contributor

dot-cor in this case ;)

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.

3 participants