Fix a bunch of scanning / tagging bugs (#3154)

* Fix possible infinite loop/stack overflow with weird/broken zip files
* Fix path length calculation using bytes instead of characters (runes)
* Fix bug where oshash gets buffers with size not actually multiple of 8
* Add oshash tests

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
alexandra-3
2022-12-01 15:48:04 +10:00
committed by GitHub
parent e614ca8d26
commit 87cea80e7b
5 changed files with 125 additions and 82 deletions

View File

@@ -7,6 +7,7 @@ import (
"regexp"
"strings"
"unicode"
"unicode/utf8"
"github.com/stashapp/stash/pkg/gallery"
"github.com/stashapp/stash/pkg/image"
@@ -77,7 +78,7 @@ func getPathWords(path string, trimExt bool) []string {
// remove any single letter words
var ret []string
for _, w := range words {
if len(w) > 1 {
if utf8.RuneCountInString(w) > 1 {
// #1450 - we need to open up the criteria for matching so that we
// can match where path has no space between subject names -
// ie name = "foo bar" - path = "foobar"