qjfoidnh / BaiduPCS-Go

iikira/BaiduPCS-Go原版基础上集成了分享链接/秒传链接转存功能
Apache License 2.0
3.01k stars 455 forks source link

下载大文件时会sigsegv #351

Open JackySu opened 3 weeks ago

JackySu commented 3 weeks ago

(由于文件本身不外传,不好意思无法提供原文件供复现) 目测是百度盘api返回值中有nil

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x69 pc=0x89e702]

goroutine 1 [running]:
github.com/qjfoidnh/BaiduPCS-Go/internal/pcscommand.RunDownload.func2(0xc0005bb1e0, 0x0)
        /home/liu/Projects/BaiduPCS-Go/internal/pcscommand/download.go:141 +0x22
sort.medianOfThree_func({0xc000db7080, 0xc0005bb1e0}, 0xc00055eb28, 0xe71f40, 0x8)
        /usr/local/go/src/sort/zfuncversion.go:53 +0x4a
sort.doPivot_func({0xc000db7080, 0xc0005bb1e0}, 0x0, 0x1186)
        /usr/local/go/src/sort/zfuncversion.go:76 +0x8a
sort.quickSort_func({0xc000db7080, 0xc0005bb1e0}, 0xc00055eb28, 0x0, 0xc00055656c)
        /usr/local/go/src/sort/zfuncversion.go:143 +0x85
sort.Slice({0x921b80, 0xc00055eb28}, 0x1400)
        /usr/local/go/src/sort/slice.go:20 +0x9f
github.com/qjfoidnh/BaiduPCS-Go/internal/pcscommand.RunDownload({0xc00093c1f0, 0x42, 0x8199e0}, 0xc000db73f8)
        /home/liu/Projects/BaiduPCS-Go/internal/pcscommand/download.go:140 +0x4fc
main.main.func22(0xc0009666e0)
        /home/liu/Projects/BaiduPCS-Go/main.go:1108 +0x3ce
github.com/urfave/cli.HandleAction({0x933640, 0xa17eb0}, 0x8)
        /home/liu/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0x9e957b, 0x8}, {0x0, 0x0}, {0xc000b23400, 0x1, 0x1}, {0x9f156a, 0x13}, {0xc000af7f20, ...}, ...}, ...)
        /home/liu/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0004388c0, {0xc0005d79a0, 0xa, 0xa})
        /home/liu/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main.func1(0xc000735080)
        /home/liu/Projects/BaiduPCS-Go/main.go:324 +0x545
github.com/urfave/cli.HandleAction({0x92b8a0, 0xc000b23360}, 0xc0004388c0)
        /home/liu/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:526 +0x50
github.com/urfave/cli.(*App).Run(0xc0004388c0, {0xc0004f21b0, 0x1, 0x1})
        /home/liu/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:286 +0x625
main.main()
        /home/liu/Projects/BaiduPCS-Go/main.go:2273 +0x6985