Headline
CVE-2022-31009: chore: remove unnecessary assert SQCORE-1299 (#5660) · wireapp/wire-ios@caa0e27
wire-ios is an iOS client for the Wire secure messaging application. Invalid accent colors of Wire communication partners may render the iOS Wire Client partially unusable by causing it to crash multiple times on launch. These invalid accent colors can be used by and sent between Wire users. The root cause was an unnecessary assert statement when converting an integer value into the corresponding enum value, causing an exception instead of a fallback to a default value. This issue is fixed in wire-ios and in Wire for iOS 3.100. There is no workaround available, but users may use other Wire clients (such as the web app) to continue using Wire, or upgrade their client.
@@ -19,6 +19,7 @@
import Foundation
import UIKit
import WireUtilities
import WireCommonComponents
@objc
enum ColorSchemeVariant: UInt {
@@ -318,14 +319,11 @@ extension UIColor {
/// Creates UIColor instance with color corresponding to @p accentColor that can be used to display the name.
class func nameColor(for accentColor: ZMAccentColor, variant: ColorSchemeVariant) -> UIColor {
assert(accentColor.rawValue <= ZMAccentColor.max.rawValue)
let accentColor = AccentColor(ZMAccentColor: accentColor) ?? .strongBlue
let coefficientsArray = variant == .dark ? accentColorNameColorBlendingCoefficientsDark : accentColorNameColorBlendingCoefficientsLight
let coefficient = coefficientsArray[Int(accentColor.rawValue)]
let background: UIColor = variant == .dark ? .black : .white
return background.mix(UIColor(fromZMAccentColor: accentColor), amount: coefficient)
return background.mix(UIColor(for: accentColor), amount: coefficient)
}
}