Skip to content

Commit

Permalink
Merge #952: Avoid computing out-of-bounds pointer.
Browse files Browse the repository at this point in the history
9be7b0f Avoid computing out-of-bounds pointer. (Tim Ruffing)

Pull request description:

  This is a pedantic case of UB.

  Spotted in #879.

ACKs for top commit:
  elichai:
    ACK 9be7b0f
  practicalswift:
    cr ACK 9be7b0f
  sipa:
    ACK 9be7b0f

Tree-SHA512: a9d028c4cdb37ad0d5fcf0d2f678eef732a653d37155a69a20272c6b283c28e083172485d7a37dc4a7c6100b22a6f5b6a92e729239031be228cc511842ee35e8
  • Loading branch information
real-or-random committed Oct 17, 2021
2 parents f34b5ca + 9be7b0f commit 920a0e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ecdsa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
if (secp256k1_der_read_len(&rlen, sig, sigend) == 0) {
return 0;
}
if (rlen == 0 || *sig + rlen > sigend) {
if (rlen == 0 || rlen > (size_t)(sigend - *sig)) {
/* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1). */
return 0;
}
Expand Down

0 comments on commit 920a0e5

Please sign in to comment.