[PM-40755] fix: App crash when fill assist toggle enabled - #2902
Conversation
Applies the same @_optimize(none) workaround used on generatedHashBase64Encoded (PM-25026) to generatedHash. The Swift compiler miscompiles calls through the `any HashFunction.Type` existential under Release optimizations, crashing DataFingerprintService.fingerprint(for:) — and therefore fill assist — only in optimized builds (e.g. TestFlight), not when run unoptimized via Xcode.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed a one-line bugfix in Code Review DetailsNo findings. The fix is minimal, correctly scoped, consistent with the established PM-25026 pattern, and satisfies the |
There was a problem hiding this comment.
Pull request overview
This PR applies an existing Swift compiler Release-optimization workaround to Data.generatedHash(using:) to prevent a Release/TestFlight-only crash when computing fingerprints (used by fill assist when enabled).
Changes:
- Add
@_optimize(none)toData.generatedHash(using:)to avoid optimizer miscompilation in Release builds. - Align the optimization workaround and TODO note with the existing
generatedHashBase64Encoded(using:)implementation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @_optimize(none) // TODO: PM-25026 Remove when optimization for this is fixed on release config. | ||
| func generatedHash( | ||
| using hashFunction: any HashFunction.Type, | ||
| ) -> String { |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-40755
📔 Objective
Fixes a Release-only crash in
DataFingerprintService.fingerprint(for:), used byFillAssistRepositorywhen the fill assist toggle is enabled.The Swift compiler miscompiles calls through the
any HashFunction.Typeexistential parameter (hashFunction.hash(data:)) under Release optimizations. This was previously identified and worked around forData.generatedHashBase64Encoded(using:)via@_optimize(none)in PM-25026 (#1871), but the sibling functionData.generatedHash(using:)— used byDataFingerprintService— was never patched. This is why the crash only reproduces in TestFlight/Release builds and not when run unoptimized via Xcode.Applies the same
@_optimize(none)workaround, referencing the existing PM-25026 TODO to remove both once the underlying compiler issue is fixed.📸 Screenshots
N/A — background crash fix, no UI changes.