]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Fix false positive static analysis issue #2
authorSergei Ianovich <sergei.ianovich@ya.ru>
Tue, 30 Jul 2024 14:55:22 +0000 (14:55 +0000)
committerSergei Ianovich <sergei.ianovich@ya.ru>
Tue, 30 Jul 2024 14:55:22 +0000 (14:55 +0000)
Infer complains:
```
test_digest.c:662: error: Dead Store
  The value written to `&p` is never used.
  660.     if (t->truncate) {
  661.         outsize = t->truncate;
  662.  params[p++] = OSSL_PARAM_construct_size_t("size", &outsize);
               ^
  663.     }
  664.     else
```

Altough the complain is false positive, fixing it will allow for future
use of the tools in automated tests.

test_digest.c

index 68c0e3253f7366cea9d8525dd7199821d92d7093..9b981f14b7b6f9aa49a2a1d0ce395cfe3ad63cd6 100644 (file)
@@ -663,6 +663,7 @@ static int do_mac(int iter, EVP_MAC *mac, const char *plaintext,
     }
     else
         outsize = EVP_MAC_CTX_get_mac_size(ctx);
+    T(p - params < 4);
 
     T(EVP_MAC_init(ctx, (const unsigned char *)t->key, t->key_size, NULL));
     T(EVP_MAC_CTX_set_params(ctx, params));