mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
Add invalid UTF-8 guards to fix #9369. Probably not a permanent fix, but putting it up here in case someone else encounters the same panic.
This commit is contained in:
parent
45beb28fa5
commit
302b352d78
@ -14,6 +14,7 @@ package fs
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/syncthing/notify"
|
"github.com/syncthing/notify"
|
||||||
)
|
)
|
||||||
@ -38,6 +39,10 @@ func (f *BasicFilesystem) Watch(name string, ignore Matcher, ctx context.Context
|
|||||||
}
|
}
|
||||||
|
|
||||||
absShouldIgnore := func(absPath string) bool {
|
absShouldIgnore := func(absPath string) bool {
|
||||||
|
if !utf8.ValidString(absPath) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
rel, err := f.unrootedChecked(absPath, roots)
|
rel, err := f.unrootedChecked(absPath, roots)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return true
|
return true
|
||||||
@ -78,7 +83,14 @@ func (f *BasicFilesystem) watchLoop(ctx context.Context, name string, roots []st
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case ev := <-backendChan:
|
case ev := <-backendChan:
|
||||||
relPath, err := f.unrootedChecked(ev.Path(), roots)
|
evPath := ev.Path()
|
||||||
|
|
||||||
|
if !utf8.ValidString(evPath) {
|
||||||
|
l.Debugln(f.Type(), f.URI(), "Watch: Ignoring invalid UTF-8")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
relPath, err := f.unrootedChecked(evPath, roots)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
select {
|
select {
|
||||||
case errChan <- err:
|
case errChan <- err:
|
||||||
|
Loading…
Reference in New Issue
Block a user