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


ssl/statem/statem_clnt.c:2210:1: Parameter `s->ctx->sessions->num_items`
2208.   }
2209.   
2210. > MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt)
2211.   {
2212.       if (PACKET_remaining(pkt) > 0) {

ssl/statem/statem_clnt.c:2235:10: Call
2233.        * the server
2234.        */
2235.       if (!ssl3_check_cert_and_algorithm(s)) {
                 ^
2236.           ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
2237.           ossl_statem_set_error(s);

ssl/statem/statem_clnt.c:3102:1: Parameter `s->ctx->sessions->num_items`
  3100.   #define has_bits(i,m)   (((i)&(m)) == (m))
  3101.   
  3102. > int ssl3_check_cert_and_algorithm(SSL *s)
  3103.   {
  3104.       int i;

ssl/statem/statem_clnt.c:2236:9: Call
2234.        */
2235.       if (!ssl3_check_cert_and_algorithm(s)) {
2236.           ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
                ^
2237.           ossl_statem_set_error(s);
2238.           return MSG_PROCESS_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:785:1: Parameter `ctx->sessions->num_items`
    783.   }
    784.   
    785. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    786.   {
    787.       return remove_session_lock(ctx, c, 1);

ssl/ssl_sess.c:787:12: Call
    785.   int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
    786.   {
    787.       return remove_session_lock(ctx, c, 1);
                      ^
    788.   }
    789.   

ssl/ssl_sess.c:790:1: Parameter `ctx->sessions->num_items`
      788.   }
      789.   
      790. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
      791.   {
      792.       SSL_SESSION *r;

ssl/ssl_sess.c:800:17: Call
      798.           if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
      799.               ret = 1;
      800.               r = lh_SSL_SESSION_delete(ctx->sessions, c);
                             ^
      801.               SSL_SESSION_list_remove(ctx, c);
      802.           }

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);
}
['MSG_PROCESS_RETURN tls_process_server_done(SSL *s, PACKET *pkt)\n{\n    if (PACKET_remaining(pkt) > 0) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);\n        SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE, SSL_R_LENGTH_MISMATCH);\n        ossl_statem_set_error(s);\n        return MSG_PROCESS_ERROR;\n    }\n#ifndef OPENSSL_NO_SRP\n    if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) {\n        if (SRP_Calc_A_param(s) <= 0) {\n            SSLerr(SSL_F_TLS_PROCESS_SERVER_DONE, SSL_R_SRP_A_CALC);\n            ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR);\n            ossl_statem_set_error(s);\n            return MSG_PROCESS_ERROR;\n        }\n    }\n#endif\n    if (!ssl3_check_cert_and_algorithm(s)) {\n        ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);\n        ossl_statem_set_error(s);\n        return MSG_PROCESS_ERROR;\n    }\n#ifndef OPENSSL_NO_SCTP\n    if (SSL_IS_DTLS(s) && BIO_dgram_is_sctp(SSL_get_wbio(s))\n            && s->renegotiate != 0)\n        return MSG_PROCESS_CONTINUE_PROCESSING;\n    else\n#endif\n        return MSG_PROCESS_FINISHED_READING;\n}', 'int ssl3_check_cert_and_algorithm(SSL *s)\n{\n    int i;\n#ifndef OPENSSL_NO_EC\n    int idx;\n#endif\n    long alg_k, alg_a;\n    EVP_PKEY *pkey = NULL;\n#ifndef OPENSSL_NO_DH\n    DH *dh;\n#endif\n    int al = SSL_AD_HANDSHAKE_FAILURE;\n    alg_k = s->s3->tmp.new_cipher->algorithm_mkey;\n    alg_a = s->s3->tmp.new_cipher->algorithm_auth;\n    if ((alg_a & SSL_aNULL) || (alg_k & SSL_kPSK))\n        return (1);\n#ifndef OPENSSL_NO_DH\n    dh = s->s3->peer_dh_tmp;\n#endif\n#ifndef OPENSSL_NO_EC\n    idx = s->session->peer_type;\n    if (idx == SSL_PKEY_ECC) {\n        if (ssl_check_srvr_ecc_cert_and_alg(s->session->peer, s) == 0) {\n            SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_BAD_ECC_CERT);\n            goto f_err;\n        } else {\n            return 1;\n        }\n    } else if (alg_a & SSL_aECDSA) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_ECDSA_SIGNING_CERT);\n        goto f_err;\n    } else if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, SSL_R_MISSING_ECDH_CERT);\n        goto f_err;\n    }\n#endif\n    pkey = X509_get_pubkey(s->session->peer);\n    i = X509_certificate_type(s->session->peer, pkey);\n    EVP_PKEY_free(pkey);\n    if ((alg_a & SSL_aRSA) && !has_bits(i, EVP_PK_RSA | EVP_PKT_SIGN)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_RSA_SIGNING_CERT);\n        goto f_err;\n    }\n#ifndef OPENSSL_NO_DSA\n    else if ((alg_a & SSL_aDSS) && !has_bits(i, EVP_PK_DSA | EVP_PKT_SIGN)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_DSA_SIGNING_CERT);\n        goto f_err;\n    }\n#endif\n#ifndef OPENSSL_NO_RSA\n    if (alg_k & (SSL_kRSA | SSL_kRSAPSK) &&\n        !has_bits(i, EVP_PK_RSA | EVP_PKT_ENC)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_RSA_ENCRYPTING_CERT);\n        goto f_err;\n    }\n#endif\n#ifndef OPENSSL_NO_DH\n    if ((alg_k & SSL_kDHE) && (dh == NULL)) {\n        al = SSL_AD_INTERNAL_ERROR;\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM, ERR_R_INTERNAL_ERROR);\n        goto f_err;\n    } else if ((alg_k & SSL_kDHr) && !SSL_USE_SIGALGS(s) &&\n               !has_bits(i, EVP_PK_DH | EVP_PKS_RSA)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_DH_RSA_CERT);\n        goto f_err;\n    }\n# ifndef OPENSSL_NO_DSA\n    else if ((alg_k & SSL_kDHd) && !SSL_USE_SIGALGS(s) &&\n             !has_bits(i, EVP_PK_DH | EVP_PKS_DSA)) {\n        SSLerr(SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM,\n               SSL_R_MISSING_DH_DSA_CERT);\n        goto f_err;\n    }\n# endif\n#endif\n    return (1);\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\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->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}']