Closed jensutbult closed 2 years ago
The fix seems okay to me! ✅
I pulled in my test app like this:
pod 'YubiKit', :git => 'https://github.com/Yubico/yubikit-ios', :branch => 'jens/ios15-otp-crash'
I could not reproduce the crash. 🍏
Interesting thing, when I tried to validate the crash, then I played around with different solutions, and this line
if (self.nfcOTPResponseBlock)
still caused crash I think because of the nature of C level blocks. And the explicit nil checking fixed the condition (if (self.nfcOTPResponseBlock == nil)
). For my understanding the objc_msgSend
is missing from the Obj-C Block
mechanism, and that's why it is vulnerable to calling them when they are nil
.
Fixes crash on iOS 15 where readerSession:didInvalidateWithError: was called twice when reading a Yubico OTP over NFC. This would happen if the user pressed cancel, sent the app to the background and then opened the app again.
The crash can not be reproduces running our automated tests which is why no new tests that validates the fix has been added. There's however a test project available here: https://github.com/jensutbult/OTP-Crash
Closes #78