gibaBR / Switch-Backup-Manager

Complete Switch Backups management tool
373 stars 54 forks source link

App does not finish opening XCZ #160

Closed garoxas closed 4 years ago

garoxas commented 4 years ago

Follow-up from discussion at #157, the app will stuck in infinite loop when opening some XCZ Some of the reported titles

@gibaBR I've reproduced it with Captain Toad title, and as you said it stuck at line 3227 I've temporary fixed it by changing said line to line below but it's hacky. Gonna take a look further later when I get time to find a proper fix while ((num4 = fileStream.ReadByte()) > 0 && num4 > 0)

garoxas commented 4 years ago

It looks like there's a discrepancy between file offset in HFS header and the actual file offset, causing in some files with better compression to attempt to read beyond the file length My previous "hacky" solution may still be needed as precaution

@gibaBR Please check my commit above. If you're okay with it, I'll make a PR Couldn't find any better solution than to abort the process when stream offset exceed file length. It works on my tests but you may need to test with yours too

gibaBR commented 4 years ago

Gonna take a look! Thank you!

Em dom, 24 de nov de 2019 13:11, Garoxas notifications@github.com escreveu:

It looks like there's a discrepancy between file offset in HFS header and the actual file offset, causing in some files with better compression to attempt to read beyond the file length My previous "hacky" solution may still be needed as precaution

@gibaBR https://github.com/gibaBR Please check my commit above. If you're okay with it, I'll make a PR Couldn't find any better solution than to abort the process when stream offset exceed file length. It works on my tests but you may need to test with yours too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gibaBR/Switch-Backup-Manager/issues/160?email_source=notifications&email_token=AFKGL2TJYSSNFXI6IQSV6XTQVKRTJA5CNFSM4JQ7VKGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFAOZCI#issuecomment-557902985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKGL2WXMPVMMBS2D6YJI2TQVKRTJANCNFSM4JQ7VKGA .

gibaBR commented 4 years ago

Its seems to work. Bad news is SMB thinks all .XCZ files are not trimmed. I'll work on this. Thank you one more time, @garoxas


Gilberto Júnior http://raspberrybrasil.blogspot.com.br/ http://www.flickr.com/photos/gibajr/

On Sun, Nov 24, 2019 at 1:45 PM Gilberto Júnior gilberto.junior@gmail.com wrote:

Gonna take a look! Thank you!

Em dom, 24 de nov de 2019 13:11, Garoxas notifications@github.com escreveu:

It looks like there's a discrepancy between file offset in HFS header and the actual file offset, causing in some files with better compression to attempt to read beyond the file length My previous "hacky" solution may still be needed as precaution

@gibaBR https://github.com/gibaBR Please check my commit above. If you're okay with it, I'll make a PR Couldn't find any better solution than to abort the process when stream offset exceed file length. It works on my tests but you may need to test with yours too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gibaBR/Switch-Backup-Manager/issues/160?email_source=notifications&email_token=AFKGL2TJYSSNFXI6IQSV6XTQVKRTJA5CNFSM4JQ7VKGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFAOZCI#issuecomment-557902985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKGL2WXMPVMMBS2D6YJI2TQVKRTJANCNFSM4JQ7VKGA .

garoxas commented 4 years ago

Yes I've noticed that too. Maybe later I'll take a look at that

gibaBR commented 4 years ago

It's solved :)

Gilberto Júnior http://raspberrybrasil.blogspot.com.br/ http://www.flickr.com/photos/gibajr/

On Mon, Nov 25, 2019 at 2:58 AM Garoxas notifications@github.com wrote:

Yes I've noticed that too. Maybe later I'll take a look at that

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/gibaBR/Switch-Backup-Manager/issues/160?email_source=notifications&email_token=AFKGL2Q6QVSXA563XN63L63QVNSRXA5CNFSM4JQ7VKGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFBHICQ#issuecomment-558003210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKGL2T6DKQN76TYYH5TSPTQVNSRXANCNFSM4JQ7VKGA .