runtime error: slice bounds out of range [33:7]

when data is huge and driver response with a limit frequency, the 'runtime error: slice bounds out of range [33:7]' error may occur.

Signed-off-by: wutongjie23hao <xiaolei.liang@qq.com>
This commit is contained in:
Xiaolei.Liang 2023-02-16 16:44:49 +08:00 committed by wutongjie23hao
parent 36d8c594d7
commit 167f1712b8

View file

@ -138,7 +138,11 @@ func compareReplaceInline(s1, s2 string, old, new byte) int {
// with Walk to do handling with repositories in a storage.
func handleRepository(fileInfo driver.FileInfo, root, last string, fn func(repoPath string) error) error {
filePath := fileInfo.Path()
if len(filePath) <= len(root) {
return nil
}
// lop the base path off
repo := filePath[len(root)+1:]