sparkle-project / Sparkle

A software update framework for macOS
https://sparkle-project.org
Other
7.34k stars 1.04k forks source link

Uncaught exception @ SPUNoUpdateFoundRecoverySuggestion() #2524

Closed fujisoft closed 5 months ago

fujisoft commented 5 months ago

Summary

There is a crash bug when prompting the no update found.

Exception Type:  SIGABRT
Exception Codes: #0 at 0x7ff816f3a1e2
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithFormat:locale:arguments:]: nil argument'

Last Exception Backtrace:
0   CoreFoundation                       0x00007ff8170c510a 0x00007ff816fd1000 + 999690
1   libobjc.A.dylib                      0x00007ff816beb0b7 0x00007ff816bd6000 + 86199
2   Foundation                           0x00007ff817e8670d 0x00007ff817e7a000 + 50957
3   Foundation                           0x00007ff817e95338 0x00007ff817e7a000 + 111416
4   Sparkle                              0x000000010be7bffe SPUNoUpdateFoundRecoverySuggestion (SPUNoUpdateFoundInfo.m:60)
5   Sparkle                              0x000000010be54c4e -[SPUBasicUpdateDriver didNotFindUpdateWithLatestAppcastItem:hostToLatestAppcastItemComparisonResult:background:] (SPUBasicUpdateDriver.m:244)
6   Sparkle                              0x000000010be6dd34 -[SUAppcastDriver appcastDidFinishLoading:inBackground:] (SUAppcastDriver.m:343)
7   Sparkle                              0x000000010be6d5e5 -[SUAppcastDriver downloadDriverDidDownloadData:] (SUAppcastDriver.m:87)
8   Sparkle                              0x000000010be5839f __66-[SPUDownloadDriver downloaderDidFinishWithTemporaryDownloadData:]_block_invoke (SPUDownloadDriver.m:0)

Some users reported the same crash. But I can not reproduce the crash on my environment. Here is one of the crash log: crashlog.txt

Possible Fix

It seems that nil-checking or try-catch is required for parameters at line 60 in SPUNoUpdateFoundInfo.m.

Version

Sparkle version 2.5.1

zorgiepoo commented 5 months ago

Nothing in that line is supposed to be nil I think so I'll need to take a closer look.

zorgiepoo commented 5 months ago

So what is happening is that SULocalizedStringFromTableInBundle() is returning nil which should not happen even if the key is missing in the localization files. It could also be possible here the bundle we get for Sparkle is nil even though it shouldn't be.

I can reproduce this issue in my app if I launch the app, move the bundle to another location, and check for updates. But this is not a supported path for apps anyway; moving apps while they're open is not valid. If we guard against not crashing here, something can potentially blow up later.

Still, it may not be out of the question to add a fallback here.

[edit]: Confirmed I get a crash trying it out on your app, although I'm missing the exception detail.

fujisoft commented 5 months ago

Thanks for the information. 3 users reported the crash last month. To avoid the crash, we have disabled the CrashOnUncaughtExceptions in the latest version of our app for workaround.