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


ssl/statem/statem_srvr.c:149:1: Parameter `s->initial_ctx->sessions->num_items`
147.    * (transition not allowed)
148.    */
149. > int ossl_statem_server_read_transition(SSL *s, int mt)
150.   {
151.       OSSL_STATEM *st = &s->statem;

ssl/statem/statem_srvr.c:292:5: Call
290.    err:
291.       /* No valid transition found */
292.       ssl3_send_alert(s, SSL3_AL_FATAL, SSL3_AD_UNEXPECTED_MESSAGE);
           ^
293.       SSLerr(SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION, SSL_R_UNEXPECTED_MESSAGE);
294.       return 0;

ssl/s3_msg.c:63:1: Parameter `s->initial_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:74:9: Call
  72.       /* If a fatal one, remove from cache */
  73.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
  74.           SSL_CTX_remove_session(s->session_ctx, s->session);
                ^
  75.   
  76.       s->s3->alert_dispatch = 1;

ssl/ssl_sess.c:715:1: Parameter `ctx->sessions->num_items`
    713.   }
    714.   
    715. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    716.   {
    717.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:717:12: Call
    715.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    716.   {
    717.       return remove_session_lock(ctx, c, 1);
                      ^
    718.   }
    719.   

ssl/ssl_sess.c:720:1: Parameter `ctx->sessions->num_items`
      718.   }
      719.   
      720. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      721.   {
      722.       SSL_SESSION *r;

ssl/ssl_sess.c:730:17: Call
      728.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
      729.               ret = 1;
      730.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                             ^
      731.               SSL_SESSION_list_remove(ctx, c);
      732.           }

ssl/ssl_locl.h:605:1: Parameter `lh->num_items`
        603.   };
        604.   
        605. > DEFINE_LHASH_OF(SSL_SESSION);
        606.   /* Needed in ssl_cert.c */
        607.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:605:1: Call
        603.   };
        604.   
        605. > DEFINE_LHASH_OF(SSL_SESSION);
        606.   /* Needed in ssl_cert.c */
        607.   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, max(0, s->initial_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);
}
['int ossl_statem_server_read_transition(SSL *s, int mt)\n{\n    OSSL_STATEM *st = &s->statem;\n    if (SSL_IS_TLS13(s)) {\n        if (!ossl_statem_server13_read_transition(s, mt))\n            goto err;\n        return 1;\n    }\n    switch (st->hand_state) {\n    default:\n        break;\n    case TLS_ST_BEFORE:\n    case DTLS_ST_SW_HELLO_VERIFY_REQUEST:\n        if (mt == SSL3_MT_CLIENT_HELLO) {\n            st->hand_state = TLS_ST_SR_CLNT_HELLO;\n            return 1;\n        }\n        break;\n    case TLS_ST_SW_SRVR_DONE:\n        if (mt == SSL3_MT_CLIENT_KEY_EXCHANGE) {\n            if (s->s3->tmp.cert_request) {\n                if (s->version == SSL3_VERSION) {\n                    if ((s->verify_mode & SSL_VERIFY_PEER)\n                        && (s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) {\n                        ssl3_send_alert(s, SSL3_AL_FATAL,\n                                        SSL3_AD_HANDSHAKE_FAILURE);\n                        SSLerr(SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION,\n                               SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE);\n                        return 0;\n                    }\n                    st->hand_state = TLS_ST_SR_KEY_EXCH;\n                    return 1;\n                }\n            } else {\n                st->hand_state = TLS_ST_SR_KEY_EXCH;\n                return 1;\n            }\n        } else if (s->s3->tmp.cert_request) {\n            if (mt == SSL3_MT_CERTIFICATE) {\n                st->hand_state = TLS_ST_SR_CERT;\n                return 1;\n            }\n        }\n        break;\n    case TLS_ST_SR_CERT:\n        if (mt == SSL3_MT_CLIENT_KEY_EXCHANGE) {\n            st->hand_state = TLS_ST_SR_KEY_EXCH;\n            return 1;\n        }\n        break;\n    case TLS_ST_SR_KEY_EXCH:\n        if (s->session->peer == NULL || st->no_cert_verify) {\n            if (mt == SSL3_MT_CHANGE_CIPHER_SPEC) {\n                st->hand_state = TLS_ST_SR_CHANGE;\n                return 1;\n            }\n        } else {\n            if (mt == SSL3_MT_CERTIFICATE_VERIFY) {\n                st->hand_state = TLS_ST_SR_CERT_VRFY;\n                return 1;\n            }\n        }\n        break;\n    case TLS_ST_SR_CERT_VRFY:\n        if (mt == SSL3_MT_CHANGE_CIPHER_SPEC) {\n            st->hand_state = TLS_ST_SR_CHANGE;\n            return 1;\n        }\n        break;\n    case TLS_ST_SR_CHANGE:\n#ifndef OPENSSL_NO_NEXTPROTONEG\n        if (s->s3->next_proto_neg_seen) {\n            if (mt == SSL3_MT_NEXT_PROTO) {\n                st->hand_state = TLS_ST_SR_NEXT_PROTO;\n                return 1;\n            }\n        } else {\n#endif\n            if (mt == SSL3_MT_FINISHED) {\n                st->hand_state = TLS_ST_SR_FINISHED;\n                return 1;\n            }\n#ifndef OPENSSL_NO_NEXTPROTONEG\n        }\n#endif\n        break;\n#ifndef OPENSSL_NO_NEXTPROTONEG\n    case TLS_ST_SR_NEXT_PROTO:\n        if (mt == SSL3_MT_FINISHED) {\n            st->hand_state = TLS_ST_SR_FINISHED;\n            return 1;\n        }\n        break;\n#endif\n    case TLS_ST_SW_FINISHED:\n        if (mt == SSL3_MT_CHANGE_CIPHER_SPEC) {\n            st->hand_state = TLS_ST_SR_CHANGE;\n            return 1;\n        }\n        break;\n    }\n err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, SSL3_AD_UNEXPECTED_MESSAGE);\n    SSLerr(SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION, SSL_R_UNEXPECTED_MESSAGE);\n    return 0;\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->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}']