Merge pull request from GHSA-q3x5-92cp-3pjr

This commit is contained in:
Kim De Mey 2022-08-19 17:22:43 +02:00 committed by GitHub
parent ab99e2de33
commit c7f1a37d9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -372,6 +372,9 @@ func fromRaw*(T: type SkRecoverableSignature, data: openArray[byte]): SkResult[T
static(&"secp: recoverable signature must be {SkRawRecoverableSignatureSize} bytes"))
let recid = cint(data[64])
if recid < 0 or recid > 3:
return err("secp: recoverable signature's recid must be >= 0 and <= 3")
var sig {.noinit.}: secp256k1_ecdsa_recoverable_signature
if secp256k1_ecdsa_recoverable_signature_parse_compact(
secp256k1_context_no_precomp, addr sig, data.ptr0, recid) != 1: