From: yangyangtiantianlonglong Date: Thu, 27 Oct 2022 09:17:55 +0000 (+0800) Subject: Potential null pointer reference X-Git-Tag: openssl-3.2.0-alpha1~1806 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15c8df81083f31dd35aedbe2d58ec702d0c0dc65;p=thirdparty%2Fopenssl.git Potential null pointer reference Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/19429) --- diff --git a/test/ectest.c b/test/ectest.c index 8e62cf01e6e..c0337e1c953 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -2724,6 +2724,13 @@ static int custom_params_test(int id) if (!TEST_ptr(ctx = BN_CTX_new())) return 0; + BN_CTX_start(ctx); + if (!TEST_ptr(p = BN_CTX_get(ctx)) + || !TEST_ptr(a = BN_CTX_get(ctx)) + || !TEST_ptr(b = BN_CTX_get(ctx)) + || !TEST_ptr(k = BN_CTX_get(ctx))) + goto err; + if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) goto err; @@ -2735,13 +2742,6 @@ static int custom_params_test(int id) } #endif - BN_CTX_start(ctx); - if (!TEST_ptr(p = BN_CTX_get(ctx)) - || !TEST_ptr(a = BN_CTX_get(ctx)) - || !TEST_ptr(b = BN_CTX_get(ctx)) - || !TEST_ptr(k = BN_CTX_get(ctx))) - goto err; - /* expected byte length of encoded points */ bsize = (EC_GROUP_get_degree(group) + 7) / 8; bsize = 1 + 2 * bsize; /* UNCOMPRESSED_POINT format */