You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using NtWriteFile and NtReadFile, perhaps other ntifs.h headers, through windows, it does not seem to properly fill out the provided IO_STATUS_BLOCK information leading to reading of potentially uninitialized memory. This issue does not seem to occur with windows-sys.
I also tried with master on windows thinking #2646 would be helpful, but it exhibits the same behaviour.
Consider this version with windows, which does not work at all times, occasionally after the call to NtWriteFile, iosb is still uninitialized. This can be seen by changing to MaybeUninit::uninit instead of MaybeUninit::zeroed
Since this is an UB issue I apologize for the hard to reproduce example here. It does seem like the projection, either due to the NTSTATUS to Error transformation or some other issue, is causing some sort of UB where NtWriteFile et. al is not working correctly.
The text was updated successfully, but these errors were encountered:
Ok, this was figured out on discord. STATUS_PENDING (0x104) is a "success" status code, not an error. But the trouble is that the windows crate doesn't return a status code on success so it can't be checked.
The only NTSTATUS status code that should be transformed into Ok should be STATUS_SUCCESS (0x00000000) imho, every other return value could possibly require additional handling.
I'll close this issue and file one with an easier repro to keep things clean here.
Summary
When using
NtWriteFile
andNtReadFile
, perhaps otherntifs.h
headers, throughwindows
, it does not seem to properly fill out the providedIO_STATUS_BLOCK
information leading to reading of potentially uninitialized memory. This issue does not seem to occur withwindows-sys
.I also tried with
master
onwindows
thinking #2646 would be helpful, but it exhibits the same behaviour.Crate manifest
Crate code
Consider this version with
windows
, which does not work at all times, occasionally after the call toNtWriteFile
,iosb
is still uninitialized. This can be seen by changing toMaybeUninit::uninit
instead ofMaybeUninit::zeroed
This version using
windows-sys
, which is intended to be equivalent, does not exhibit this behaviour (mixingwindows
code for Result types etc.)Since this is an UB issue I apologize for the hard to reproduce example here. It does seem like the projection, either due to the NTSTATUS to Error transformation or some other issue, is causing some sort of UB where
NtWriteFile
et. al is not working correctly.The text was updated successfully, but these errors were encountered: