test/ssltestlib.c:654: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `SSL_connect`.
Showing all 26 steps of the trace


test/ssltestlib.c:654:20: Call
652.           err = SSL_ERROR_WANT_WRITE;
653.           while (!clienterr && retc <= 0 && err == SSL_ERROR_WANT_WRITE) {
654.               retc = SSL_connect(clientssl);
                          ^
655.               if (retc <= 0)
656.                   err = SSL_get_error(clientssl, retc);

ssl/ssl_lib.c:1469:1: Parameter `s->session_ctx->sessions->num_items`
  1467.   }
  1468.   
  1469. > int SSL_connect(SSL *s)
  1470.   {
  1471.       if (s->handshake_func == NULL) {

ssl/ssl_lib.c:1476:12: Call
  1474.       }
  1475.   
  1476.       return SSL_do_handshake(s);
                     ^
  1477.   }
  1478.   

ssl/ssl_lib.c:3245:1: Parameter `s->session_ctx->sessions->num_items`
    3243.   }
    3244.   
    3245. > int SSL_do_handshake(SSL *s)
    3246.   {
    3247.       int ret = 1;

test/ssltestlib.c:654:20: Call
652.           err = SSL_ERROR_WANT_WRITE;
653.           while (!clienterr && retc <= 0 && err == SSL_ERROR_WANT_WRITE) {
654.               retc = SSL_connect(clientssl);
                          ^
655.               if (retc <= 0)
656.                   err = SSL_get_error(clientssl, retc);

ssl/ssl_lib.c:1469:1: Parameter `s->session_ctx->sessions->num_items`
  1467.   }
  1468.   
  1469. > int SSL_connect(SSL *s)
  1470.   {
  1471.       if (s->handshake_func == NULL) {

ssl/ssl_lib.c:1476:12: Call
  1474.       }
  1475.   
  1476.       return SSL_do_handshake(s);
                     ^
  1477.   }
  1478.   

ssl/ssl_lib.c:3245:1: Parameter `s->session_ctx->sessions->num_items`
    3243.   }
    3244.   
    3245. > int SSL_do_handshake(SSL *s)
    3246.   {
    3247.       int ret = 1;

test/ssltestlib.c:654:20: Call
652.           err = SSL_ERROR_WANT_WRITE;
653.           while (!clienterr && retc <= 0 && err == SSL_ERROR_WANT_WRITE) {
654.               retc = SSL_connect(clientssl);
                          ^
655.               if (retc <= 0)
656.                   err = SSL_get_error(clientssl, retc);

ssl/ssl_lib.c:1469:1: Parameter `s->session_ctx->sessions->num_items`
  1467.   }
  1468.   
  1469. > int SSL_connect(SSL *s)
  1470.   {
  1471.       if (s->handshake_func == NULL) {

ssl/ssl_lib.c:1476:12: Call
  1474.       }
  1475.   
  1476.       return SSL_do_handshake(s);
                     ^
  1477.   }
  1478.   

ssl/ssl_lib.c:3245:1: Parameter `s->session_ctx->sessions->num_items`
    3243.   }
    3244.   
    3245. > int SSL_do_handshake(SSL *s)
    3246.   {
    3247.       int ret = 1;

ssl/ssl_lib.c:3257:17: Call
    3255.           int edfin;
    3256.   
    3257.           edfin = ssl_write_early_finish(s);
                            ^
    3258.           if (edfin <= 0)
    3259.               return edfin;

ssl/ssl_lib.c:1865:1: Parameter `s->session_ctx->sessions->num_items`
      1863.   }
      1864.   
      1865. > static int ssl_write_early_finish(SSL *s)
      1866.   {
      1867.       int ret;

ssl/ssl_lib.c:1875:11: Call
      1873.   
      1874.       s->early_data_state = SSL_EARLY_DATA_WRITING;
      1875.       ret = ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_END_OF_EARLY_DATA);
                        ^
      1876.       if (ret <= 0) {
      1877.           s->early_data_state = SSL_EARLY_DATA_WRITE_RETRY;

ssl/s3_msg.c:63:1: Parameter `s->session_ctx->sessions->num_items`
        61.   }
        62.   
        63. > int ssl3_send_alert(SSL *s, int level, int desc)
        64.   {
        65.       /* Map tls/ssl alert value to correct one */

ssl/s3_msg.c:77:9: Call
        75.       /* If a fatal one, remove from cache */
        76.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
        77.           SSL_CTX_remove_session(s->session_ctx, s->session);
                      ^
        78.   
        79.       s->s3->alert_dispatch = 1;

ssl/ssl_sess.c:724:1: Parameter `ctx->sessions->num_items`
          722.   }
          723.   
          724. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
          725.   {
          726.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:726:12: Call
          724.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
          725.   {
          726.       return remove_session_lock(ctx, c, 1);
                            ^
          727.   }
          728.   

ssl/ssl_sess.c:729:1: Parameter `ctx->sessions->num_items`
            727.   }
            728.   
            729. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
            730.   {
            731.       SSL_SESSION *r;

ssl/ssl_sess.c:739:17: Call
            737.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
            738.               ret = 1;
            739.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                                   ^
            740.               SSL_SESSION_list_remove(ctx, c);
            741.           }

ssl/ssl_locl.h:688:1: Parameter `lh->num_items`
              686.   } CLIENTHELLO_MSG;
              687.   
              688. > DEFINE_LHASH_OF(SSL_SESSION);
              689.   /* Needed in ssl_cert.c */
              690.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:688:1: Call
              686.   } CLIENTHELLO_MSG;
              687.   
              688. > DEFINE_LHASH_OF(SSL_SESSION);
              689.   /* Needed in ssl_cert.c */
              690.   DEFINE_LHASH_OF(X509_NAME);

crypto/lhash/lhash.c:103:1: <LHS trace>
101.   }
102.   
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104.   {
105.       unsigned long hash;

crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
                101.   }
                102.   
                103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
                104.   {
                105.       unsigned long hash;

crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_connect` 
                121.       }
                122.   
                123.       lh->num_items--;
                           ^
                124.       if ((lh->num_nodes > MIN_NODES) &&
                125.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
    unsigned long hash;
    OPENSSL_LH_NODE *nn, **rn;
    void *ret;
    lh->error = 0;
    rn = getrn(lh, data, &hash);
    if (*rn == NULL) {
        lh->num_no_delete++;
        return (NULL);
    } else {
        nn = *rn;
        *rn = nn->next;
        ret = nn->data;
        OPENSSL_free(nn);
        lh->num_delete++;
    }
    lh->num_items--;
    if ((lh->num_nodes > MIN_NODES) &&
        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
        contract(lh);
    return (ret);
}
['int create_ssl_connection(SSL *serverssl, SSL *clientssl, int want)\n{\n    int retc = -1, rets = -1, err, abortctr = 0;\n    int clienterr = 0, servererr = 0;\n    unsigned char buf;\n    size_t readbytes;\n    do {\n        err = SSL_ERROR_WANT_WRITE;\n        while (!clienterr && retc <= 0 && err == SSL_ERROR_WANT_WRITE) {\n            retc = SSL_connect(clientssl);\n            if (retc <= 0)\n                err = SSL_get_error(clientssl, retc);\n        }\n        if (!clienterr && retc <= 0 && err != SSL_ERROR_WANT_READ) {\n            printf("SSL_connect() failed %d, %d\\n", retc, err);\n            clienterr = 1;\n        }\n        if (want != SSL_ERROR_NONE && err == want)\n            return 0;\n        err = SSL_ERROR_WANT_WRITE;\n        while (!servererr && rets <= 0 && err == SSL_ERROR_WANT_WRITE) {\n            rets = SSL_accept(serverssl);\n            if (rets <= 0)\n                err = SSL_get_error(serverssl, rets);\n        }\n        if (!servererr && rets <= 0 && err != SSL_ERROR_WANT_READ) {\n            printf("SSL_accept() failed %d, %d\\n", rets, err);\n            servererr = 1;\n        }\n        if (want != SSL_ERROR_NONE && err == want)\n            return 0;\n        if (clienterr && servererr)\n            return 0;\n        if (++abortctr == MAXLOOPS) {\n            printf("No progress made\\n");\n            return 0;\n        }\n    } while (retc <=0 || rets <= 0);\n    if (SSL_read_ex(clientssl, &buf, sizeof(buf), &readbytes) > 0) {\n        if (readbytes != 0) {\n            printf("Unexpected success reading data %"OSSLzu"\\n", readbytes);\n            return 0;\n        }\n    } else if (SSL_get_error(clientssl, 0) != SSL_ERROR_WANT_READ) {\n        printf("SSL_read_ex() failed\\n");\n        return 0;\n    }\n    return 1;\n}', 'int SSL_connect(SSL *s)\n{\n    if (s->handshake_func == NULL) {\n        SSL_set_connect_state(s);\n    }\n    return SSL_do_handshake(s);\n}', 'int SSL_do_handshake(SSL *s)\n{\n    int ret = 1;\n    if (s->handshake_func == NULL) {\n        SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET);\n        return -1;\n    }\n    if (s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) {\n        int edfin;\n        edfin = ssl_write_early_finish(s);\n        if (edfin <= 0)\n            return edfin;\n    }\n    ossl_statem_check_finish_init(s, -1);\n    s->method->ssl_renegotiate_check(s, 0);\n    if (SSL_in_init(s) || SSL_in_before(s)) {\n        if ((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {\n            struct ssl_async_args args;\n            args.s = s;\n            ret = ssl_start_async_job(s, &args, ssl_do_handshake_intern);\n        } else {\n            ret = s->handshake_func(s);\n        }\n    }\n    return ret;\n}', 'static int ssl_write_early_finish(SSL *s)\n{\n    int ret;\n    if (s->early_data_state != SSL_EARLY_DATA_WRITE_RETRY) {\n        SSLerr(SSL_F_SSL_WRITE_EARLY_FINISH, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);\n        return 0;\n    }\n    s->early_data_state = SSL_EARLY_DATA_WRITING;\n    ret = ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_END_OF_EARLY_DATA);\n    if (ret <= 0) {\n        s->early_data_state = SSL_EARLY_DATA_WRITE_RETRY;\n        return 0;\n    }\n    s->early_data_state = SSL_EARLY_DATA_FINISHED_WRITING;\n    EVP_CIPHER_CTX_free(s->enc_write_ctx);\n    s->enc_write_ctx = NULL;\n    ossl_statem_set_in_init(s, 1);\n    return 1;\n}', 'int ssl3_send_alert(SSL *s, int level, int desc)\n{\n    if (SSL_TREAT_AS_TLS13(s))\n        desc = tls13_alert_code(desc);\n    else\n        desc = s->method->ssl3_enc->alert_value(desc);\n    if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION)\n        desc = SSL_AD_HANDSHAKE_FAILURE;\n    if (desc < 0)\n        return -1;\n    if ((level == SSL3_AL_FATAL) && (s->session != NULL))\n        SSL_CTX_remove_session(s->session_ctx, s->session);\n    s->s3->alert_dispatch = 1;\n    s->s3->send_alert[0] = level;\n    s->s3->send_alert[1] = desc;\n    if (!RECORD_LAYER_write_pending(&s->rlayer)) {\n        return s->method->ssl_dispatch_alert(s);\n    }\n    return -1;\n}', 'int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)\n{\n    return remove_session_lock(ctx, c, 1);\n}', 'static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)\n{\n    SSL_SESSION *r;\n    int ret = 0;\n    if ((c != NULL) && (c->session_id_length != 0)) {\n        if (lck)\n            CRYPTO_THREAD_write_lock(ctx->lock);\n        if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {\n            ret = 1;\n            r = lh_SSL_SESSION_delete(ctx->sessions, c);\n            SSL_SESSION_list_remove(ctx, c);\n        }\n        c->not_resumable = 1;\n        if (lck)\n            CRYPTO_THREAD_unlock(ctx->lock);\n        if (ret)\n            SSL_SESSION_free(r);\n        if (ctx->remove_session_cb != NULL)\n            ctx->remove_session_cb(ctx, c);\n    } else\n        ret = 0;\n    return (ret);\n}', 'DEFINE_LHASH_OF(SSL_SESSION)', 'void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE *nn, **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_no_delete++;\n        return (NULL);\n    } else {\n        nn = *rn;\n        *rn = nn->next;\n        ret = nn->data;\n        OPENSSL_free(nn);\n        lh->num_delete++;\n    }\n    lh->num_items--;\n    if ((lh->num_nodes > MIN_NODES) &&\n        (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))\n        contract(lh);\n    return (ret);\n}']