Skip to content

Commit 9be7b0f

Browse files
Avoid computing out-of-bounds pointer.
This is a pedantic case of UB.
1 parent 8ae56e3 commit 9be7b0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ecdsa_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char
112112
if (secp256k1_der_read_len(&rlen, sig, sigend) == 0) {
113113
return 0;
114114
}
115-
if (rlen == 0 || *sig + rlen > sigend) {
115+
if (rlen == 0 || rlen > (size_t)(sigend - *sig)) {
116116
/* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1). */
117117
return 0;
118118
}

0 commit comments

Comments
 (0)