Skip to content
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

Fix potential crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH #361

merged 5 commits into from Jan 26, 2022


Copy link

@hu13 hu13 commented Mar 3, 2021

What does this pull request do?

Fix #318.

Where should the reviewer start?

How should this be manually tested?

The crash only happens when we enable recursive watch on windows here: by changing the argument flag from false to true.

Then if we create a really long filepath (see code snippet in #318), and begin watching on the first parent directory of that path and let the recursive watch propagates, fsnotify will crash.

panic: runtime error: slice bounds out of range

goroutine 765 [running, locked to thread]:


        /home/builder/go/src/filesync_daemon/fsnotify/windows.go:456 +0xfb1

created by filesync_daemon/fsnotify.NewWatcher

        /home/builder/go/src/filesync_daemon/fsnotify/windows.go:46 +0x21c

windows.go Show resolved Hide resolved
mattn approved these changes Jan 26, 2022
@mattn mattn merged commit 712fe1d into fsnotify:main Jan 26, 2022
1 check passed
Copy link

mattn commented Jan 26, 2022

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

fsnotify can crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH
2 participants