From 257ac1279877f05a997c76f58fc0c7af08e02718 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 12 Aug 2025 15:32:15 +0200 Subject: [PATCH] test/stack_test.c: check sk_sint_push result in test_int_stack coverity complains about possible double free, which does not seem to be the case with the current implementation, but it still would be nice to check and reacto on unexpected sk_sint_push result. Complements: 9837496142cf "Unit tests for crypto/stack." Resolves: https://scan5.scan.coverity.com/#/project-view/65249/10222?selectedIssue=1662046 Related: https://github.com/openssl/project/issues/1317 Signed-off-by: Eugene Syromiatnikov Reviewed-by: Tomas Mraz Reviewed-by: Shane Lontis Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/28238) --- test/stack_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/stack_test.c b/test/stack_test.c index d44e6fc93a3..5ea84d5be27 100644 --- a/test/stack_test.c +++ b/test/stack_test.c @@ -94,7 +94,10 @@ static int test_int_stack(int reserve) TEST_info("int stack size %d", i); goto end; } - sk_sint_push(s, v + i); + if (!TEST_int_eq(sk_sint_push(s, v + i), i + 1)) { + TEST_info("int stack size %d", i); + goto end; + } } if (!TEST_int_eq(sk_sint_num(s), n)) goto end; -- 2.47.3