Skip to content

Repro for #1496 (crash on any Git remote operation) #1992

Description

@wizzard0

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

  1. Generate a fresh ssh key. Do not add it on the server just yet.
  2. Add it to the folder git settings in FSNotes.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions