From 8ffc02f0ffff6160f6dbe94d2255ada55142476a Mon Sep 17 00:00:00 2001 From: Dmitry Bespalov Date: Fri, 31 May 2024 15:28:35 +0200 Subject: [PATCH] GH-3406 testing option of crash due to subtraction overflow --- .../OwnerKeyManagement/KeystoneOwnerKey/KeystoneSignFlow.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Multisig/UI/Settings/OwnerKeyManagement/KeystoneOwnerKey/KeystoneSignFlow.swift b/Multisig/UI/Settings/OwnerKeyManagement/KeystoneOwnerKey/KeystoneSignFlow.swift index aa62aa4bb..ccc96e7b0 100644 --- a/Multisig/UI/Settings/OwnerKeyManagement/KeystoneOwnerKey/KeystoneSignFlow.swift +++ b/Multisig/UI/Settings/OwnerKeyManagement/KeystoneOwnerKey/KeystoneSignFlow.swift @@ -126,7 +126,7 @@ extension SECP256K1.UnmarshaledSignature { } else { // v still can be `{0, 1} + chainId * 2 + 35` for non-legacy transactions (chainId >=0) if vInt >= 35 { - let vRecovered = UInt64(vBytes) - chainIdTerm + let vRecovered = (UInt64(vBytes) < chainIdTerm) ? 0 : (UInt64(vBytes) - chainIdTerm) v = try! UInt8(vRecovered) } else { v = vInt