crypto/bio/bss_dgram.c:309: error: UNINITIALIZED_VALUE
  The value read from timeleft.tv_sec was never initialized.
Showing all 1 steps of the trace


crypto/bio/bss_dgram.c:309:9: 
307.           /* Calculate time left until timer expires */
308.           memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));
309. >         timeleft.tv_sec -= timenow.tv_sec;
310.           timeleft.tv_usec -= timenow.tv_usec;
311.           if (timeleft.tv_usec < 0) {

static void dgram_adjust_rcv_timeout(BIO *b)
{
# if defined(SO_RCVTIMEO)
    bio_dgram_data *data = (bio_dgram_data *)b->ptr;
    union {
        size_t s;
        int i;
    } sz = {
        0
    };
    if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) {
        struct timeval timenow, timeleft;
#  ifdef OPENSSL_SYS_WINDOWS
        int timeout;
        sz.i = sizeof(timeout);
        if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
                       (void *)&timeout, &sz.i) < 0) {
            perror("getsockopt");
        } else {
            data->socket_timeout.tv_sec = timeout / 1000;
            data->socket_timeout.tv_usec = (timeout % 1000) * 1000;
        }
#  else
        sz.i = sizeof(data->socket_timeout);
        if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
                       &(data->socket_timeout), (void *)&sz) < 0) {
            perror("getsockopt");
        } else if (sizeof(sz.s) != sizeof(sz.i) && sz.i == 0)
            OPENSSL_assert(sz.s <= sizeof(data->socket_timeout));
#  endif
        get_current_time(&timenow);
        memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));
        timeleft.tv_sec -= timenow.tv_sec;
        timeleft.tv_usec -= timenow.tv_usec;
        if (timeleft.tv_usec < 0) {
            timeleft.tv_sec--;
            timeleft.tv_usec += 1000000;
        }
        if (timeleft.tv_sec < 0) {
            timeleft.tv_sec = 0;
            timeleft.tv_usec = 1;
        }
        if ((data->socket_timeout.tv_sec == 0
             && data->socket_timeout.tv_usec == 0)
            || (data->socket_timeout.tv_sec > timeleft.tv_sec)
            || (data->socket_timeout.tv_sec == timeleft.tv_sec
                && data->socket_timeout.tv_usec >= timeleft.tv_usec)) {
#  ifdef OPENSSL_SYS_WINDOWS
            timeout = timeleft.tv_sec * 1000 + timeleft.tv_usec / 1000;
            if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
                           (void *)&timeout, sizeof(timeout)) < 0) {
                perror("setsockopt");
            }
#  else
            if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &timeleft,
                           sizeof(struct timeval)) < 0) {
                perror("setsockopt");
            }
#  endif
        }
    }
# endif
}
['static void dgram_adjust_rcv_timeout(BIO *b)\n{\n# if defined(SO_RCVTIMEO)\n    bio_dgram_data *data = (bio_dgram_data *)b->ptr;\n    union {\n        size_t s;\n        int i;\n    } sz = {\n        0\n    };\n    if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) {\n        struct timeval timenow, timeleft;\n#  ifdef OPENSSL_SYS_WINDOWS\n        int timeout;\n        sz.i = sizeof(timeout);\n        if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,\n                       (void *)&timeout, &sz.i) < 0) {\n            perror("getsockopt");\n        } else {\n            data->socket_timeout.tv_sec = timeout / 1000;\n            data->socket_timeout.tv_usec = (timeout % 1000) * 1000;\n        }\n#  else\n        sz.i = sizeof(data->socket_timeout);\n        if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,\n                       &(data->socket_timeout), (void *)&sz) < 0) {\n            perror("getsockopt");\n        } else if (sizeof(sz.s) != sizeof(sz.i) && sz.i == 0)\n            OPENSSL_assert(sz.s <= sizeof(data->socket_timeout));\n#  endif\n        get_current_time(&timenow);\n        memcpy(&timeleft, &(data->next_timeout), sizeof(struct timeval));\n        timeleft.tv_sec -= timenow.tv_sec;\n        timeleft.tv_usec -= timenow.tv_usec;\n        if (timeleft.tv_usec < 0) {\n            timeleft.tv_sec--;\n            timeleft.tv_usec += 1000000;\n        }\n        if (timeleft.tv_sec < 0) {\n            timeleft.tv_sec = 0;\n            timeleft.tv_usec = 1;\n        }\n        if ((data->socket_timeout.tv_sec == 0\n             && data->socket_timeout.tv_usec == 0)\n            || (data->socket_timeout.tv_sec > timeleft.tv_sec)\n            || (data->socket_timeout.tv_sec == timeleft.tv_sec\n                && data->socket_timeout.tv_usec >= timeleft.tv_usec)) {\n#  ifdef OPENSSL_SYS_WINDOWS\n            timeout = timeleft.tv_sec * 1000 + timeleft.tv_usec / 1000;\n            if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,\n                           (void *)&timeout, sizeof(timeout)) < 0) {\n                perror("setsockopt");\n            }\n#  else\n            if (setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, &timeleft,\n                           sizeof(struct timeval)) < 0) {\n                perror("setsockopt");\n            }\n#  endif\n        }\n    }\n# endif\n}']