giwty / switch-library-manager

Complete solution to manage, organize and keep your local switch backup game library up to date . Cross platform, supports all game formats.
230 stars 43 forks source link

panic: runtime error: slice bounds out of range #105

Closed DarkCTO closed 8 months ago

DarkCTO commented 8 months ago

It was working until very recently

/run/media/kudy/DATA/Software/switch-library-manager/switch-library-manager
 100% |████████████████████████████████████████|  [0s:0s]

panic: runtime error: slice bounds out of range [11565:240]

goroutine 1 [running]:
github.com/giwty/switch-library-manager/switchfs.readPfs0(0x7fc263fd9000, 0xc0004da820, 0x0, 0x7fc263fd9000, 0xc0004da820, 0x0)
    /Users/twig/IdeaProjects/nsp-update/switchfs/pfs0.go:92 +0x6ba
github.com/giwty/switch-library-manager/switchfs.ReadPfs0File(0xc000117380, 0x75, 0x0, 0x0, 0x0)
    /Users/twig/IdeaProjects/nsp-update/switchfs/pfs0.go:40 +0xc4
github.com/giwty/switch-library-manager/switchfs.ReadNspMetadata(0xc000117380, 0x75, 0x0, 0x0, 0x0)
    /Users/twig/IdeaProjects/nsp-update/switchfs/nsp.go:12 +0x77
github.com/giwty/switch-library-manager/db.(*LocalSwitchDBManager).getGameMetadata(0xc014d6bda8, 0xc0148cce4a, 0x2b, 0xc0148cce00, 0x4a, 0x32892950, 0x0, 0xc000117380, 0x75, 0xc0147aa150, ...)
    /Users/twig/IdeaProjects/nsp-update/db/localSwitchFilesDB.go:303 +0xc02
github.com/giwty/switch-library-manager/db.(*LocalSwitchDBManager).processLocalFiles(0xc014d6bda8, 0xc014d4a000, 0x201, 0x400, 0xa97fc0, 0xc0002816c0, 0xc0147aa120, 0xc0147aa150)
    /Users/twig/IdeaProjects/nsp-update/db/localSwitchFilesDB.go:200 +0x44e
github.com/giwty/switch-library-manager/db.(*LocalSwitchDBManager).CreateLocalSwitchFilesDB(0xc014d6bda8, 0xc0147a0050, 0x1, 0x1, 0xa97fc0, 0xc0002816c0, 0x101, 0x1, 0x0, 0x0)
    /Users/twig/IdeaProjects/nsp-update/db/localSwitchFilesDB.go:108 +0x20b
main.(*Console).Start(0xc0002816c0)
    /Users/twig/IdeaProjects/nsp-update/console.go:109 +0x763
main.main()
    /Users/twig/IdeaProjects/nsp-update/main.go:53 +0x3f4
DarkCTO commented 8 months ago

Seems like there are some files that trigger this

DarkCTO commented 8 months ago

Found the files, it's corrupted