]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix dead code/constant expression in simdutf test
authorNeil Horman <nhorman@openssl.org>
Wed, 31 Dec 2025 14:19:42 +0000 (09:19 -0500)
committerNeil Horman <nhorman@openssl.org>
Sun, 4 Jan 2026 22:51:56 +0000 (17:51 -0500)
Coverity issues:
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677828
and
https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1677827

caught some dead code in the simdutf test.

The total variable is defined as an int, which is tested against <=
INT_MAX, and > INT_MAX, which will always be true, and false
respectively, making the <= test needless, and the condition the latter
bounds dead code

Clean that up.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29525)

test/test_base64_simdutf.c

index 74cbab240a0c0d0d8339eca929e7b41e39bdc02e..65c3b747ff1a9140949a3cad16a13af714596f9b 100644 (file)
@@ -121,7 +121,7 @@ static int evp_encodeupdate_old(EVP_ENCODE_CTX *ctx, unsigned char *out, int *ou
         }
         *out = '\0';
     }
-    while (inl >= ctx->length && total <= INT_MAX) {
+    while (inl >= ctx->length) {
         j = evp_encodeblock_int_old(ctx, out, in, ctx->length);
         in += ctx->length;
         inl -= ctx->length;
@@ -133,11 +133,6 @@ static int evp_encodeupdate_old(EVP_ENCODE_CTX *ctx, unsigned char *out, int *ou
         }
         *out = '\0';
     }
-    if (total > INT_MAX) {
-        /* Too much output data! */
-        *outl = 0;
-        return 0;
-    }
     if (inl != 0)
         memcpy(&(ctx->enc_data[0]), in, inl);
     ctx->num = inl;