From 31cd9cd830f847c0effc7c15b814f890228c3739 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Wed, 24 Jul 2024 16:10:53 -0400 Subject: [PATCH] Fix coverity-993406 Coverity flagged an overflow warning in the cmsapitest. Its pretty insignificant, but if a huge file is passed in via BIO, its possible for the length variable returned to overflow. Just check it as we read to silence coverity on it. Reviewed-by: Matt Caswell Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/24995) --- test/cmsapitest.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/cmsapitest.c b/test/cmsapitest.c index 5839eb74310..0684afd10e6 100644 --- a/test/cmsapitest.c +++ b/test/cmsapitest.c @@ -332,6 +332,9 @@ static unsigned char *read_all(BIO *bio, long *p_len) if (ret < 0) break; + if (LONG_MAX - ret < *p_len) + break; + *p_len += ret; if (ret < step) -- 2.47.2