Skip to content

Conversation

@vthib
Copy link

@vthib vthib commented Dec 8, 2025

The ntfs crate could panic on some data because of a false "unreachable" instruction in error.rs: the binrw error is not guaranteed to only be an IO error, it can also be for example a backtrace error.

I have reached this panic several times in different contexts.

This PR removes this unreachable which is too dangerous: any update of binrw could make this unreachable wrong, it is better to be conservative here.

The ntfs crate could panic on some data because of a false
"unreachable" instruction in error.rs: the binrw error is
not guaranteed to only be an IO error, it can also be for
example a backtrace error.

Remove this unreachable which is too dangerous: any update of
binrw could make this unreachable wrong, it is better to be
conservative here.
@ColinFinck
Copy link
Owner

Thanks for reporting! This happened when I exchanged the abandoned binread dependency by its successor binrw. Backtrace didn't exist back in binread times.

Looking at Backtrace, it's a heavyweight error type that requires heap allocations and carries a full-blown backtrace. That wouldn't be a problem when used in an std context, but it can be a problem when used in a no_std context. I only want to propagate that Backtrace error via my NtfsError when it's absolutely necessary. And it seems like that's only the case when the "verbose-backtrace" feature of binrw is enabled.

Checking with the binrw authors on Discord if they can confirm this and what's the right way to proceed here.

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.

2 participants