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


ssl/statem/statem_srvr.c:1519:1: Parameter `s->ctx->sessions->num_items`
1517.   }
1518.   
1519. > WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
1520.   {
1521.       int al = SSL_AD_HANDSHAKE_FAILURE;

ssl/statem/statem_srvr.c:1615:5: Call
1613.       return WORK_FINISHED_STOP;
1614.    f_err:
1615.       ssl3_send_alert(s, SSL3_AL_FATAL, al);
            ^
1616.       ossl_statem_set_error(s);
1617.       return WORK_ERROR;

ssl/s3_msg.c:166:1: Parameter `s->ctx->sessions->num_items`
  164.   }
  165.   
  166. > int ssl3_send_alert(SSL *s, int level, int desc)
  167.   {
  168.       /* Map tls/ssl alert value to correct one */

ssl/s3_msg.c:177:9: Call
  175.       /* If a fatal one, remove from cache */
  176.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
  177.           SSL_CTX_remove_session(s->ctx, s->session);
                 ^
  178.   
  179.       s->s3->alert_dispatch = 1;

ssl/ssl_sess.c:776:1: Parameter `ctx->sessions->num_items`
    774.   }
    775.   
    776. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    777.   {
    778.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:778:12: Call
    776.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    777.   {
    778.       return remove_session_lock(ctx, c, 1);
                      ^
    779.   }
    780.   

ssl/ssl_sess.c:781:1: Parameter `ctx->sessions->num_items`
      779.   }
      780.   
      781. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      782.   {
      783.       SSL_SESSION *r;

ssl/ssl_sess.c:791:17: Call
      789.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
      790.               ret = 1;
      791.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                             ^
      792.               SSL_SESSION_list_remove(ctx, c);
      793.           }

crypto/lhash/lhash.c:189:1: <LHS trace>
187.   }
188.   
189. > void *lh_delete(_LHASH *lh, const void *data)
190.   {
191.       unsigned long hash;

crypto/lhash/lhash.c:189:1: Parameter `lh->num_items`
        187.   }
        188.   
        189. > void *lh_delete(_LHASH *lh, const void *data)
        190.   {
        191.       unsigned long hash;

crypto/lhash/lhash.c:209:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert` 
        207.       }
        208.   
        209.       lh->num_items--;
                   ^
        210.       if ((lh->num_nodes > MIN_NODES) &&
        211.           (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))

void *lh_delete(_LHASH *lh, const void *data)
{
    unsigned long hash;
    LHASH_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    SSL_CIPHER *cipher;\n    if (wst == WORK_MORE_A) {\n        if (!s->hit) {\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, SSL_R_CERT_CB_ERROR);\n                    goto f_err;\n                }\n                if (rv < 0) {\n                    s->rwstate = SSL_X509_LOOKUP;\n                    return WORK_MORE_A;\n                }\n                s->rwstate = SSL_NOTHING;\n            }\n            cipher = ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s));\n            if (cipher == NULL) {\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, SSL_R_NO_SHARED_CIPHER);\n                goto f_err;\n            }\n            s->s3->tmp.new_cipher = cipher;\n            if (s->not_resumable_session_cb != NULL)\n                s->session->not_resumable = s->not_resumable_session_cb(s,\n                    ((cipher->algorithm_mkey & (SSL_kDHE | SSL_kECDHE)) != 0));\n            if (s->session->not_resumable)\n                s->tlsext_ticket_expected = 0;\n        } else {\n            s->s3->tmp.new_cipher = s->session->cipher;\n        }\n        if (!SSL_USE_SIGALGS(s) || !(s->verify_mode & SSL_VERIFY_PEER)) {\n            if (!ssl3_digest_cached_records(s, 0)) {\n                al = SSL_AD_INTERNAL_ERROR;\n                goto f_err;\n            }\n        }\n        if (s->version >= SSL3_VERSION) {\n            if (ssl_check_clienthello_tlsext_late(s) <= 0) {\n                SSLerr(SSL_F_TLS_POST_PROCESS_CLIENT_HELLO,\n                       SSL_R_CLIENTHELLO_TLSEXT);\n                goto f_err;\n            }\n        }\n        wst = WORK_MORE_B;\n    }\n#ifndef OPENSSL_NO_SRP\n    if (wst == WORK_MORE_B) {\n        int ret;\n        if ((ret = ssl_check_srp_ext_ClientHello(s, &al)) < 0) {\n            s->rwstate = SSL_X509_LOOKUP;\n            return WORK_MORE_B;\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            goto f_err;\n        }\n    }\n#endif\n    s->renegotiate = 2;\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    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->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_w_lock(CRYPTO_LOCK_SSL_CTX);\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        if (lck)\n            CRYPTO_w_unlock(CRYPTO_LOCK_SSL_CTX);\n        if (ret) {\n            r->not_resumable = 1;\n            if (ctx->remove_session_cb != NULL)\n                ctx->remove_session_cb(ctx, r);\n            SSL_SESSION_free(r);\n        }\n    } else\n        ret = 0;\n    return (ret);\n}', 'void *lh_delete(_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    LHASH_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}']