diff options
author | Pauli <pauli@openssl.org> | 2022-01-10 11:10:34 +1100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-09 15:31:05 +0100 |
commit | c737132dff034a6efbcf27edd0cfd7997cd299c5 (patch) | |
tree | 36aefe4e7640e8ed383b128e8d83cd955440f015 /test | |
parent | 59548647a81fe77319cd66a4587d700ef3bd18bf (diff) |
test: check for properly raised errors during param conversion
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17440)
(cherry picked from commit 291c5b3e39f4c98e61cf7f65056fe49780d1f0ac)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/params_conversion_test.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/params_conversion_test.c b/test/params_conversion_test.c index 30477e8127..01a768efd0 100644 --- a/test/params_conversion_test.c +++ b/test/params_conversion_test.c @@ -190,7 +190,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) double d; if (!pc->valid_i32) { - if (!TEST_false(OSSL_PARAM_get_int32(pc->param, &i32))) { + if (!TEST_false(OSSL_PARAM_get_int32(pc->param, &i32)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to int32 on line %d", line); return 0; } @@ -210,7 +211,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_i64) { - if (!TEST_false(OSSL_PARAM_get_int64(pc->param, &i64))) { + if (!TEST_false(OSSL_PARAM_get_int64(pc->param, &i64)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to int64 on line %d", line); return 0; } @@ -230,7 +232,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_u32) { - if (!TEST_false(OSSL_PARAM_get_uint32(pc->param, &u32))) { + if (!TEST_false(OSSL_PARAM_get_uint32(pc->param, &u32)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to uint32 on line %d", line); return 0; } @@ -250,7 +253,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_u64) { - if (!TEST_false(OSSL_PARAM_get_uint64(pc->param, &u64))) { + if (!TEST_false(OSSL_PARAM_get_uint64(pc->param, &u64)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to uint64 on line %d", line); return 0; } @@ -270,7 +274,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_d) { - if (!TEST_false(OSSL_PARAM_get_double(pc->param, &d))) { + if (!TEST_false(OSSL_PARAM_get_double(pc->param, &d)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to double on line %d", line); return 0; } |