-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Use ReadOnlySpan<byte> for parsing FileWatcher responses #42474
Conversation
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs
Show resolved
Hide resolved
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs
Show resolved
Hide resolved
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs
Show resolved
Hide resolved
break; | ||
} | ||
|
||
if (info.NextEntryOffset == 0 || info.NextEntryOffset > (uint)buffer.Length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes another potential problem where things can wrong in the original code. For example, the original code can get into infinite loop with corrupted data here. We will just exit the loop now.
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs
Outdated
Show resolved
Hide resolved
In general I like the change here. I left one comment regarding allow throwing when getting wrong size from the OS. other than that LGTM. |
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs
Show resolved
Hide resolved
@jkotas do you think your change here would be risky if we port it to 3.1 (instead of @carlossanlop fix)? I am seeing the change size is almost same. |
I think that the original @carlossanlop change is more appropriate for servicing. It is a bit less invasive. |
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ReadDirectoryChangesW.cs
Outdated
Show resolved
Hide resolved
e1efa50
to
357823e
Compare
357823e
to
bf2faa9
Compare
No description provided.