From: Pauli Date: Fri, 18 Jun 2021 04:43:24 +0000 (+1000) Subject: params: fix range check when converting double to uint64_t. X-Git-Tag: openssl-3.0.0-beta2~282 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9d022d78faee0648c3ace7f15ccec08f14feddb;p=thirdparty%2Fopenssl.git params: fix range check when converting double to uint64_t. Found in #15815 Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/15819) --- diff --git a/crypto/params.c b/crypto/params.c index a1db5dba26..9049041e3b 100644 --- a/crypto/params.c +++ b/crypto/params.c @@ -1029,7 +1029,7 @@ int OSSL_PARAM_set_double(OSSL_PARAM *p, double val) * 15 bits of UINT64_MAX to avoid using imprecise floating * point values. */ - && (double)(UINT64_MAX - 65535) + 65536.0) { + && val < (double)(UINT64_MAX - 65535) + 65536.0) { p->return_size = sizeof(uint64_t); *(uint64_t *)p->data = (uint64_t)val; return 1;