Page MenuHome GnuPG

Potential use of uninitialized variable
Closed, ResolvedPublic

Description

/usr/local/bin/clang -DHAVE_CONFIG_H -I. -I.. -I../src -I../src
-fsanitize=address -fsanitize=undefined -I/usr/local/include -fsanitize=address
-fsanitize=undefined -fno-sanitize=vptr -fvisibility=hidden -Wall -MT fipsdrv.o
-MD -MP -MF .deps/fipsdrv.Tpo -c -o fipsdrv.o fipsdrv.c
fipsdrv.c:752:7: warning: variable 's_sig' is used uninitialized whenever 'if'

    condition is false [-Wsometimes-uninitialized]
if (!err)
    ^~~~

fipsdrv.c:760:10: note: uninitialized use occurs here

return s_sig;
       ^~~~~

fipsdrv.c:752:3: note: remove the 'if' if its condition is always true

if (!err)
^~~~~~~~~

fipsdrv.c:741:20: note: initialize the variable 's_sig' to silence this warning

gcry_sexp_t s_sig;
                 ^
                  = NULL

fipsdrv.c:1299:7: warning: variable 's_keyspec' is used uninitialized whenever

    'if' condition is true [-Wsometimes-uninitialized]
if (!datalen)
    ^~~~~~~~

fipsdrv.c:1307:33: note: uninitialized use occurs here

err = gcry_pk_genkey (&s_key, s_keyspec);
                              ^~~~~~~~~

fipsdrv.c:1299:3: note: remove the 'if' if its condition is always false

if (!datalen)
^~~~~~~~~~~~~

fipsdrv.c:1294:24: note: initialize the variable 's_keyspec' to silence this

    warning
gcry_sexp_t s_keyspec, s_key, s_top, l1;
                     ^
                      = NULL

fipsdrv.c:1558:11: warning: variable 's_data' is used uninitialized whenever

'if' condition is false [-Wsometimes-uninitialized]
if (!err)
    ^~~~

fipsdrv.c:1571:31: note: uninitialized use occurs here

err = gcry_pk_sign (&s_sig, s_data, s_key);
                            ^~~~~~

fipsdrv.c:1558:7: note: remove the 'if' if its condition is always true

if (!err)
^~~~~~~~~

fipsdrv.c:1533:21: note: initialize the variable 's_data' to silence this

    warning
gcry_sexp_t s_data, s_key, s_sig, s_tmp;
                  ^
                   = NULL

fipsdrv.c:1645:11: warning: variable 's_data' is used uninitialized whenever

'if' condition is false [-Wsometimes-uninitialized]
if (!err)
    ^~~~

fipsdrv.c:1660:32: note: uninitialized use occurs here

err = gcry_pk_verify (s_sig, s_data, s_key);
                             ^~~~~~

fipsdrv.c:1645:7: note: remove the 'if' if its condition is always true

if (!err)
^~~~~~~~~

fipsdrv.c:1624:21: note: initialize the variable 's_data' to silence this

    warning
gcry_sexp_t s_data, s_key, s_sig;
                  ^
                   = NULL

fipsdrv.c:1757:43: warning: adding 'int' to a string does not append to the

string [-Wstring-plus-int]
l2 = gcry_sexp_find_token (l1, "pqg"+idx, 1);
                               ~~~~~^~~~

fipsdrv.c:1757:43: note: use array indexing to silence this warning

l2 = gcry_sexp_find_token (l1, "pqg"+idx, 1);
                                    ^
                               &    [   ]

fipsdrv.c:1880:7: warning: variable 's_data' is used uninitialized whenever 'if'

    condition is false [-Wsometimes-uninitialized]
if (!err)
    ^~~~

fipsdrv.c:1892:31: note: uninitialized use occurs here

err = gcry_pk_sign (&s_sig, s_data, s_key);
                            ^~~~~~

fipsdrv.c:1880:3: note: remove the 'if' if its condition is always true

if (!err)
^~~~~~~~~

fipsdrv.c:1874:21: note: initialize the variable 's_data' to silence this

    warning
gcry_sexp_t s_data, s_key, s_sig, s_tmp, s_tmp2;
                  ^
                   = NULL

fipsdrv.c:1974:7: warning: variable 's_data' is used uninitialized whenever 'if'

    condition is false [-Wsometimes-uninitialized]
if (!err)
    ^~~~

fipsdrv.c:1987:32: note: uninitialized use occurs here

err = gcry_pk_verify (s_sig, s_data, s_key);
                             ^~~~~~

fipsdrv.c:1974:3: note: remove the 'if' if its condition is always true

if (!err)
^~~~~~~~~

fipsdrv.c:1966:21: note: initialize the variable 's_data' to silence this

    warning
gcry_sexp_t s_data, s_key, s_sig;
                  ^
                   = NULL

7 warnings generated.

Details

Version
1.6.3

Event Timeline

JW set Version to 1.6.3.
JW added a subscriber: JW.
werner claimed this task.
werner added a project: Mistaken.

No c+p of warnings please! Use gnupg-devel for such things.