Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
mattn merged 5 commits into
fsnotify:mainfsnotify/fsnotify:mainfrom
PreVeil:issue-318PreVeil/fsnotify:issue-318Copy head branch name to clipboard
Jan 26, 2022
Merged

Fix potential crash on windows if raw.FileNameLength exceeds syscall.MAX_PATH#361
mattn merged 5 commits into
fsnotify:mainfsnotify/fsnotify:mainfrom
PreVeil:issue-318PreVeil/fsnotify:issue-318Copy head branch name to clipboard

Conversation

@hu13

@hu13 hu13 commented Mar 3, 2021

Copy link
Copy Markdown
Contributor

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

Comment thread windows.go
@mattn
mattn merged commit 712fe1d into fsnotify:main Jan 26, 2022
@mattn

mattn commented Jan 26, 2022

Copy link
Copy Markdown
Contributor

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.