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
merged 5 commits into from Jan 26, 2022

Conversation

hu13
Copy link
Contributor

@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: https://github.com/fsnotify/fsnotify/blob/master/windows.go#L350 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]:

filesync_daemon/fsnotify.(*Watcher).readEvents(0xc000c78f40)

        /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 mattn merged commit 712fe1d into fsnotify:main Jan 26, 2022
@mattn
Copy link
Member

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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