You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Capturing in make/cc mode...
Found 79 source files to analyze in /root/work/infer-out
toxcore/Messenger.c:2734: error: Uninitialized Value
The value read from dht2m[_] was never initialized.
2732.
2733. for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) {
2734. const Friend *const msgfptr = dht2m[friend_idx] >= 0 ? &m->friendlist[dht2m[friend_idx]] : nullptr;
^
2735. const DHT_Friend *const dhtfptr = dht_get_friend(m->dht, friend_idx);
2736.
toxcore/Messenger.c:2739: error: Uninitialized Value
The value read from dht2m[_] was never initialized.
2737. if (msgfptr != nullptr) {
2738. char id_str[IDSTRING_LEN];
2739. LOGGER_TRACE(m->log, "F[%2u:%2u] <%s> %s",
^
2740. dht2m[friend_idx], friend_idx, msgfptr->name,
2741. id_to_string(msgfptr->real_pk, id_str, sizeof(id_str)));
toxcore/Messenger.c:2723: error: Uninitialized Value
The value read from m2dht[_] was never initialized.
2721.
2722. for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) {
2723. if (m2dht[friend_idx] >= 0) {
^
2724. assert(friend_idx < INT32_MAX);
2725. dht2m[m2dht[friend_idx]] = (int32_t)friend_idx;
toxcore/group_chats.c:6190: error: Dead Store
The value written to &ret (type int) is never used.
6188. }
6189.
6190. int ret = -1;
^
6191. const uint16_t payload_len = (uint16_t)len;
6192.
Found 4 issues
Issue Type(ISSUED_TYPE_ID): #
Uninitialized Value(UNINITIALIZED_VALUE): 3
Dead Store(DEAD_STORE): 1
Both dht2m and m2dht arrays are initialized to -1 in the loop right after their declaration:
Version: v1.1.0
System: Debian Bullseye
Command:
ran in the root directory of https://github.com/TokTok/c-toxcore repository.
Infer incorrectly reports Uninitialized Value:
Both
dht2m
andm2dht
arrays are initialized to -1 in the loop right after their declaration:https://github.com/TokTok/c-toxcore/blob/66453439acf79a35eb46fe66a1c72595e7d0c9ca/toxcore/Messenger.c#L2701-L2720
(Note that
break
breaks just the inner loop, the outer loop runs in its entirety, fully initializing the arrays).VAL
macro is defined in https://github.com/TokTok/c-toxcore/blob/66453439acf79a35eb46fe66a1c72595e7d0c9ca/toxcore/ccompat.h, expands toif you run
gcc -E
orclang -E
on the code.The text was updated successfully, but these errors were encountered: