-
Notifications
You must be signed in to change notification settings - Fork 14
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
Crashes on long path lengths on Windows #18
Comments
That seems weird. The code in question checks for failure, and not having enough space in the buffer should be a failure: Lines 158 to 166 in bee73f2
Maybe it's a result of a server that's using customized drivers (or other third party kernel tweaks) or maybe there's a bug in that version of Windows Server. Either way I guess it'll have to verify the |
In #18 there is a report that under some situations `GetFileInformationByHandleEx` can produce a file name with a length that extends beyond the end of the buffer. Check for this case and return false if it is. Also, backport the change from std to only search the file name for "msys-" and "cygwin-", rather than the whole path.
I've now prepared #19 with a check that the filename length is in bounds before we use it. |
* Handle `GetFileInformationByHandleEx` returning a long filename. In #18 there is a report that under some situations `GetFileInformationByHandleEx` can produce a file name with a length that extends beyond the end of the buffer. Check for this case and return false if it is. Also, backport the change from std to only search the file name for "msys-" and "cygwin-", rather than the whole path. * Rebase the implementation on std's implementation.
Hi @sunfishcode, is there any plan to have a point release in a few days? We're going to cut a beta backport on Cargo side. No worries if there is not. Thank you for the quick fix! |
I've now released is-terminal 0.4.4 with this fix. |
As reported in sunfishcode/is-terminal#18, there are situations where `GetFileInformationByHandleEx` can write a file name length that is longer than the provided buffer. To avoid deferencing memory past the end of the buffer, use a bounds-checked function to form a slice to the buffer and handle the out-of-bounds case. This ports the fix from sunfishcode/is-terminal#19 to std's `is_terminal` implementation.
chore: bump is-terminal to 0.4.4 Fixes #11710. See sunfishcode/is-terminal#18 See also rust-lang/rust#108391
…l-file-length, r=ChrisDenton Fix `is_terminal`'s handling of long paths on Windows. As reported in sunfishcode/is-terminal#18, there are situations where `GetFileInformationByHandleEx` can write a file name length that is longer than the provided buffer. To avoid deferencing memory past the end of the buffer, use a bounds-checked function to form a slice to the buffer and handle the out-of-bounds case. This ports the fix from sunfishcode/is-terminal#19 to std's `is_terminal` implementation.
…l-file-length, r=ChrisDenton Fix `is_terminal`'s handling of long paths on Windows. As reported in sunfishcode/is-terminal#18, there are situations where `GetFileInformationByHandleEx` can write a file name length that is longer than the provided buffer. To avoid deferencing memory past the end of the buffer, use a bounds-checked function to form a slice to the buffer and handle the out-of-bounds case. This ports the fix from sunfishcode/is-terminal#19 to std's `is_terminal` implementation.
As reported in sunfishcode/is-terminal#18, there are situations where `GetFileInformationByHandleEx` can write a file name length that is longer than the provided buffer. To avoid deferencing memory past the end of the buffer, use a bounds-checked function to form a slice to the buffer and handle the out-of-bounds case. This ports the fix from sunfishcode/is-terminal#19 to std's `is_terminal` implementation.
…ngth, r=ChrisDenton Fix `is_terminal`'s handling of long paths on Windows. As reported in sunfishcode/is-terminal#18, there are situations where `GetFileInformationByHandleEx` can write a file name length that is longer than the provided buffer. To avoid deferencing memory past the end of the buffer, use a bounds-checked function to form a slice to the buffer and handle the out-of-bounds case. This ports the fix from sunfishcode/is-terminal#19 to std's `is_terminal` implementation.
In some situations involving long paths it is possible that `GetFileInformationByHandleEx` produces a `FILE_NAME_INFO` with `FileNameLength` exceeding the provided buffer [1]. Return `false` from `msys_tty_on` if that happens, instead of reading beyond the end of the allocation. [1] sunfishcode/is-terminal#18
In some situations involving long paths it is possible that `GetFileInformationByHandleEx` produces a `FILE_NAME_INFO` with `FileNameLength` exceeding the provided buffer [1]. Return `false` from `msys_tty_on` if that happens, instead of reading beyond the end of the allocation. [1] sunfishcode/is-terminal#18
cargo
just got a report of a crash on Windows with long paths (rust-lang/cargo#11710)The text was updated successfully, but these errors were encountered: