Avoid computing out-of-bounds pointer.

This is a pedantic case of UB.
This commit is contained in:
Tim Ruffing 2021-06-16 10:33:41 +02:00
parent 8ae56e33e7
commit 9be7b0f083
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}