summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2022-03-11 06:57:26 +0000
committerTomas Mraz <tomas@openssl.org>2022-03-15 13:05:40 +0100
commit1832bb0f02e519a48f06a10467c7ce5f7f3feeeb (patch)
treec07c67f9c5d830b107ea8035d71dee823648e5d5 /test
parentef9909f3c6471ba39be1e3d18a366044cbf30a19 (diff)
Fix signed integer overflow in evp_enc
Fixes #17869. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17870)
Diffstat (limited to 'test')
-rw-r--r--test/sanitytest.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sanitytest.c b/test/sanitytest.c
index b1aadc4aa8..ec850651d2 100644
--- a/test/sanitytest.c
+++ b/test/sanitytest.c
@@ -114,6 +114,13 @@ static int test_sanity_range(void)
TEST_error("int must not be wider than size_t");
return 0;
}
+
+ /* SIZE_MAX is always greater than 2*INT_MAX */
+ if (SIZE_MAX - INT_MAX <= INT_MAX) {
+ TEST_error("SIZE_MAX must exceed 2*INT_MAX");
+ return 0;
+ }
+
return 1;
}