Use non-throwing filesystem checks - #1165
Merged
Merged
Conversation
std::filesystem::exists and current_path throw filesystem_error when the path is inaccessible (e.g. EACCES from posix_stat), which crashed the UI when launching the debugger on a container file whose original path could not be stat'ed. Switch to the std::error_code overloads so an inaccessible path is treated as non-existent instead of terminating. Fixes BINARYNINJA-HC Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same crash class as BINARYNINJA-HC: fs::exists, fs::canonical and fs::remove throw filesystem_error when a path is inaccessible. Switch the remaining unguarded call sites (WinDbg/TTD install and DbgEng path validation) to the std::error_code overloads. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
plafosse
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch unguarded
fs::exists/canonical/remove/current_pathcalls to thestd::error_codeoverloads so an inaccessible path (EACCES etc.) is treated as non-existent instead of terminating the process.Fixes #1163
Fixes BINARYNINJA-HC