ssl/statem/statem_srvr.c:2059: error: INTEGER_OVERFLOW_L2
  ([0, 1+max(0, `s->session_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`.
Showing all 13 steps of the trace


ssl/statem/statem_srvr.c:1938:1: Parameter `s->session_ctx->sessions->num_items`
1936.   }
1937.   
1938. > WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
1939.   {
1940.       int al = SSL_AD_HANDSHAKE_FAILURE;

ssl/statem/statem_srvr.c:2059:5: Call
2057.       return WORK_FINISHED_STOP;
2058.    f_err:
2059.       ssl3_send_alert(s, SSL3_AL_FATAL, al);
            ^
2060.       ossl_statem_set_error(s);
2061.       return WORK_ERROR;

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:725:1: Parameter `ctx->sessions->num_items`
    723.   }
    724.   
    725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    726.   {
    727.       return remove_session_lock(ctx, c, 1);

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

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

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

ssl/ssl_locl.h:721:1: Parameter `lh->num_items`
        719.   } TLSEXT_INDEX;
        720.   
        721. > DEFINE_LHASH_OF(SSL_SESSION);
        722.   /* Needed in ssl_cert.c */
        723.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:721:1: Call
        719.   } TLSEXT_INDEX;
        720.   
        721. > DEFINE_LHASH_OF(SSL_SESSION);
        722.   /* Needed in ssl_cert.c */
        723.   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, 1+max(0, s->session_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert` 
          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);
}
['WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)\n{\n    int al = SSL_AD_HANDSHAKE_FAILURE;\n    const SSL_CIPHER *cipher;\n    if (wst == WORK_MORE_A) {\n        int rv = tls_early_post_process_client_hello(s, &al);\n        if (rv == 0) {\n            goto f_err;\n        }\n        if (rv < 0)\n            return WORK_MORE_A;\n        wst = WORK_MORE_B;\n    }\n    if (wst == WORK_MORE_B) {\n        if (!s->hit || s->hello_retry_request) {\n            if (s->cert->cert_cb) {\n                int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg);\n                if (rv == 0) {\n                    al = SSL_AD_INTERNAL_ERROR;\n                    SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                           SSL_R_CERT_CB_ERROR);\n                    goto f_err;\n                }\n                if (rv < 0) {\n                    s->rwstate = SSL_X509_LOOKUP;\n                    return WORK_MORE_B;\n                }\n                s->rwstate = SSL_NOTHING;\n            }\n            cipher =\n                ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));\n            if (cipher == NULL) {\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                       SSL_R_NO_SHARED_CIPHER);\n                goto f_err;\n            }\n            if (SSL_IS_TLS13(s) && s->s3->tmp.new_cipher != NULL\n                    && s->s3->tmp.new_cipher->id != cipher->id) {\n                al = SSL_AD_ILLEGAL_PARAMETER;\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_BAD_CIPHER);\n                goto f_err;\n            }\n            s->s3->tmp.new_cipher = cipher;\n            if (!s->hit) {\n                if (!tls_choose_sigalg(s, &al))\n                    goto f_err;\n                if (s->not_resumable_session_cb != NULL)\n                    s->session->not_resumable =\n                        s->not_resumable_session_cb(s, ((cipher->algorithm_mkey\n                                                        & (SSL_kDHE | SSL_kECDHE))\n                                                       != 0));\n                if (s->session->not_resumable)\n                    s->ext.ticket_expected = 0;\n            }\n        } else {\n            s->s3->tmp.new_cipher = s->session->cipher;\n        }\n        if (!tls_handle_status_request(s, &al)) {\n            SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                   SSL_R_CLIENTHELLO_TLSEXT);\n            goto f_err;\n        }\n        wst = WORK_MORE_C;\n    }\n#ifndef OPENSSL_NO_SRP\n    if (wst == WORK_MORE_C) {\n        int ret;\n        if ((ret = ssl_check_srp_ext_ClientHello(s, &al)) < 0) {\n            s->rwstate = SSL_X509_LOOKUP;\n            return WORK_MORE_C;\n        }\n        if (ret != SSL_ERROR_NONE) {\n            if (al != TLS1_AD_UNKNOWN_PSK_IDENTITY)\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                       SSL_R_CLIENTHELLO_TLSEXT);\n            else\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                       SSL_R_PSK_IDENTITY_NOT_FOUND);\n            goto f_err;\n        }\n    }\n#endif\n    return WORK_FINISHED_STOP;\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\n    ossl_statem_set_error(s);\n    return WORK_ERROR;\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}']