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

<filesystem>: fix dangerous noexcept specification of _Current_path #3869

Merged
merged 2 commits into from Jul 14, 2023

Conversation

achabense
Copy link
Contributor

@achabense achabense commented Jul 12, 2023

_Current_path is wrongly marked as noexcept, which will cause the program to terminate if resize throws.

STL/stl/inc/filesystem

Lines 4045 to 4046 in 2261f7e

_NODISCARD inline __std_win_error _Current_path(path& _Result) noexcept {
_Result._Text.resize(__std_fs_max_path);

This pr fixes it by merging the function into throwable path current_path(error_code&).

@achabense achabense requested a review from a team as a code owner July 12, 2023 15:44
@github-actions github-actions bot added this to Initial Review in Code Reviews Jul 12, 2023
@StephanTLavavej StephanTLavavej added bug Something isn't working filesystem C++17 filesystem labels Jul 12, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jul 12, 2023
stl/inc/filesystem Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

Great catch, thanks! 😻 I couldn't resist pushing a stylistic nitpick even though this resets testing.

@StephanTLavavej StephanTLavavej removed their assignment Jul 13, 2023
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in Code Reviews Jul 13, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jul 13, 2023
@StephanTLavavej
Copy link
Member

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in Code Reviews Jul 13, 2023
@StephanTLavavej StephanTLavavej merged commit f51733c into microsoft:main Jul 14, 2023
35 checks passed
Code Reviews automation moved this from Ready To Merge to Done Jul 14, 2023
@StephanTLavavej
Copy link
Member

Thanks for noticing and fixing this silent bad codegen! 🦅 👁️ ✅

@achabense achabense deleted the _FS_noexcept_fix branch July 14, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working filesystem C++17 filesystem
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants