Skip to content

Commit

Permalink
Avoid computing out-of-bounds pointer.
Browse files Browse the repository at this point in the history
This is a pedantic case of UB.
  • Loading branch information
real-or-random committed Jun 16, 2021
1 parent 8ae56e3 commit 9be7b0f
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 9be7b0f

Please sign in to comment.