Description
Before stumbling into #1991 I also hit the auth crash similar to the one from #1496 (def reproduces on two different iPhones).
How to reproduce
- Generate a fresh ssh key. Do not add it on the server just yet.
- Add it to the folder git settings in FSNotes.
- Observe the app just disappears when you press Push/Pull (or after creating the commit in Add/Commit/Push)
Workaround: adding pubkey to the user's pubkey list on the server makes the push/pull simply proceed correctly
Root cause (disclaimer: by Claude)
The culprit appears to be in setAuthenticationCallback (FSNotesCore/Git/authentication/Authentication.swift): the payload is created with Unmanaged.passRetained(...) (one retain), but the credentials callback does takeRetainedValue(), which consumes a retain on every invocation. libgit2 invokes the credentials callback multiple times per connection when the first auth attempt is rejected → second invocation over-releases → use-after-free → crash. Changing it to takeUnretainedValue() (and balancing the release when callbacks are torn down) should fix #1496.
FSNotes version
7.3.2 build 337 (App Store), iOS
Description
Before stumbling into #1991 I also hit the auth crash similar to the one from #1496 (def reproduces on two different iPhones).
How to reproduce
Workaround: adding pubkey to the user's pubkey list on the server makes the push/pull simply proceed correctly
Root cause (disclaimer: by Claude)
The culprit appears to be in
setAuthenticationCallback(FSNotesCore/Git/authentication/Authentication.swift): the payload is created withUnmanaged.passRetained(...)(one retain), but the credentials callback doestakeRetainedValue(), which consumes a retain on every invocation. libgit2 invokes the credentials callback multiple times per connection when the first auth attempt is rejected → second invocation over-releases → use-after-free → crash. Changing it totakeUnretainedValue()(and balancing the release when callbacks are torn down) should fix #1496.FSNotes version
7.3.2 build 337 (App Store), iOS