Skip to content

Commit

Permalink
GH-3406 testing option of crash due to subtraction overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBespalov committed May 31, 2024
1 parent fb255a5 commit 8ffc02f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8ffc02f

Please sign in to comment.