Thanks to visit codestin.com
Credit goes to github.com

Skip to content

std.file.rename: avoid segfault on null string (#10727) #10768

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

Closed

Conversation

Mahipalsinh00
Copy link
Contributor

Fixes #10727: std.file.rename segfaults when source or destination is null on Windows.

  • Check for null fromz and toz before calling wcslen.
  • If null, leave f/t null instead of slicing.
  • Added runtime unittests to assert FileException is thrown for null inputs
    (rename("", null) and rename(null, "")).

- Added null-checks on fromz/toz before slicing, so rename(null, …) or rename(…, null) no longer crashes.
- Added runtime unittest to assert FileException is thrown for null inputs.
@CyberShadow
Copy link
Member

Is this a duplicate of #10736? Looks like that one targeted the stable branch, which is why it might not be in master.

@ibuclaw
Copy link
Member

ibuclaw commented May 1, 2025

Yes, please target the stable branch.

@Mahipalsinh00
Copy link
Contributor Author

Closing in favor of the stable branch PR #10769

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.

std.file.rename segfaults on null string on Windows
3 participants