Skip to content

fuzz-handle_onion_message: variable 'daemon' is used uninitialized whenever 'if' condition is true #8683

@fanquake

Description

@fanquake

Turned up in fuzzing infra:

 #10 479.9 tests/fuzz/fuzz-handle_onion_message.c:78:6: error: variable 'daemon' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
#10 479.9    78 |         if (setjmp(fuzz_env) != 0)
#10 479.9       |             ^~~~~~~~~~~~~~~~~~~~~
#10 479.9 /usr/include/setjmp.h:49:21: note: expanded from macro 'setjmp'
#10 479.9    49 | #define setjmp(env)     _setjmp (env)
#10 479.9       |                         ^
#10 479.9 tests/fuzz/fuzz-handle_onion_message.c:104:6: note: uninitialized use occurs here
#10 479.9   104 |         if (daemon)
#10 479.9       |             ^~~~~~
#10 479.9 tests/fuzz/fuzz-handle_onion_message.c:78:2: note: remove the 'if' if its condition is always false
#10 479.9    78 |         if (setjmp(fuzz_env) != 0)
#10 479.9       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
#10 479.9    79 |                 goto cleanup;
#10 479.9       |                 ~~~~~~~~~~~~
#10 479.9 tests/fuzz/fuzz-handle_onion_message.c:81:23: note: initialize the variable 'daemon' to silence this warning
#10 479.9    81 |         struct daemon *daemon;
#10 479.9       |                              ^
#10 479.9       |                               = NULL
#10 479.9 1 error generated.
#10 479.9 make: *** [Makefile:332: tests/fuzz/fuzz-handle_onion_message.o] Error 1

cc @dergoegge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions