ssl/record/rec_layer_d1.c:355: error: INTEGER_OVERFLOW_L2
  ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`.
Showing all 15 steps of the trace


ssl/record/rec_layer_d1.c:342:1: Parameter `s->ctx->sessions->num_items`
340.   
341.   
342. > int dtls1_process_buffered_records(SSL *s)
343.   {
344.       pitem *item;

ssl/record/rec_layer_d1.c:355:18: Call
353.           while (pqueue_peek(s->rlayer.d->unprocessed_rcds.q)) {
354.               dtls1_get_unprocessed_record(s);
355.               if (!dtls1_process_record(s))
                        ^
356.                   return (0);
357.               if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds),

ssl/record/ssl3_record.c:1203:1: Parameter `s->ctx->sessions->num_items`
  1201.   }
  1202.   
  1203. > int dtls1_process_record(SSL *s)
  1204.   {
  1205.       int i, al;

ssl/record/ssl3_record.c:1362:5: Call
  1360.   
  1361.    f_err:
  1362.       ssl3_send_alert(s, SSL3_AL_FATAL, al);
              ^
  1363.    err:
  1364.       return (0);

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

ssl/s3_msg.c:176:9: Call
    174.       /* If a fatal one, remove from cache */
    175.       if ((level == SSL3_AL_FATAL) && (s->session != NULL))
    176.           SSL_CTX_remove_session(s->ctx, s->session);
                   ^
    177.   
    178.       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.           }

ssl/ssl_locl.h:681:1: Parameter `lh->num_items`
          679.   };
          680.   
          681. > DEFINE_LHASH_OF(SSL_SESSION);
          682.   /* Needed in ssl_cert.c */
          683.   DEFINE_LHASH_OF(X509_NAME);

ssl/ssl_locl.h:681:1: Call
          679.   };
          680.   
          681. > DEFINE_LHASH_OF(SSL_SESSION);
          682.   /* Needed in ssl_cert.c */
          683.   DEFINE_LHASH_OF(X509_NAME);

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

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

crypto/lhash/lhash.c:208:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record` 
            206.       }
            207.   
            208.       lh->num_items--;
                       ^
            209.       if ((lh->num_nodes > MIN_NODES) &&
            210.           (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);
}
['int dtls1_process_buffered_records(SSL *s)\n{\n    pitem *item;\n    item = pqueue_peek(s->rlayer.d->unprocessed_rcds.q);\n    if (item) {\n        if (s->rlayer.d->unprocessed_rcds.epoch != s->rlayer.d->r_epoch)\n            return (1);\n        while (pqueue_peek(s->rlayer.d->unprocessed_rcds.q)) {\n            dtls1_get_unprocessed_record(s);\n            if (!dtls1_process_record(s))\n                return (0);\n            if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds),\n                SSL3_RECORD_get_seq_num(&s->rlayer.rrec)) < 0)\n                return -1;\n        }\n    }\n    s->rlayer.d->processed_rcds.epoch = s->rlayer.d->r_epoch;\n    s->rlayer.d->unprocessed_rcds.epoch = s->rlayer.d->r_epoch + 1;\n    return (1);\n}', 'int dtls1_process_record(SSL *s)\n{\n    int i, al;\n    int enc_err;\n    SSL_SESSION *sess;\n    SSL3_RECORD *rr;\n    unsigned int mac_size;\n    unsigned char md[EVP_MAX_MD_SIZE];\n    rr = RECORD_LAYER_get_rrec(&s->rlayer);\n    sess = s->session;\n    rr->input = &(RECORD_LAYER_get_packet(&s->rlayer)[DTLS1_RT_HEADER_LENGTH]);\n    if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) {\n        al = SSL_AD_RECORD_OVERFLOW;\n        SSLerr(SSL_F_DTLS1_PROCESS_RECORD, SSL_R_ENCRYPTED_LENGTH_TOO_LONG);\n        goto f_err;\n    }\n    rr->data = rr->input;\n    rr->orig_len = rr->length;\n    enc_err = s->method->ssl3_enc->enc(s, 0);\n    if (enc_err == 0) {\n        rr->length = 0;\n        RECORD_LAYER_reset_packet_length(&s->rlayer);\n        goto err;\n    }\n#ifdef TLS_DEBUG\n    printf("dec %d\\n", rr->length);\n    {\n        unsigned int z;\n        for (z = 0; z < rr->length; z++)\n            printf("%02X%c", rr->data[z], ((z + 1) % 16) ? \' \' : \'\\n\');\n    }\n    printf("\\n");\n#endif\n    if ((sess != NULL) &&\n        (s->enc_read_ctx != NULL) && (EVP_MD_CTX_md(s->read_hash) != NULL)) {\n        unsigned char *mac = NULL;\n        unsigned char mac_tmp[EVP_MAX_MD_SIZE];\n        mac_size = EVP_MD_CTX_size(s->read_hash);\n        OPENSSL_assert(mac_size <= EVP_MAX_MD_SIZE);\n        if (rr->orig_len < mac_size ||\n            (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE &&\n             rr->orig_len < mac_size + 1)) {\n            al = SSL_AD_DECODE_ERROR;\n            SSLerr(SSL_F_DTLS1_PROCESS_RECORD, SSL_R_LENGTH_TOO_SHORT);\n            goto f_err;\n        }\n        if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) {\n            mac = mac_tmp;\n            ssl3_cbc_copy_mac(mac_tmp, rr, mac_size);\n            rr->length -= mac_size;\n        } else {\n            rr->length -= mac_size;\n            mac = &rr->data[rr->length];\n        }\n        i = s->method->ssl3_enc->mac(s, md, 0   );\n        if (i < 0 || mac == NULL\n            || CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0)\n            enc_err = -1;\n        if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + mac_size)\n            enc_err = -1;\n    }\n    if (enc_err < 0) {\n        rr->length = 0;\n        RECORD_LAYER_reset_packet_length(&s->rlayer);\n        goto err;\n    }\n    if (s->expand != NULL) {\n        if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH) {\n            al = SSL_AD_RECORD_OVERFLOW;\n            SSLerr(SSL_F_DTLS1_PROCESS_RECORD,\n                   SSL_R_COMPRESSED_LENGTH_TOO_LONG);\n            goto f_err;\n        }\n        if (!ssl3_do_uncompress(s)) {\n            al = SSL_AD_DECOMPRESSION_FAILURE;\n            SSLerr(SSL_F_DTLS1_PROCESS_RECORD, SSL_R_BAD_DECOMPRESSION);\n            goto f_err;\n        }\n    }\n    if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH) {\n        al = SSL_AD_RECORD_OVERFLOW;\n        SSLerr(SSL_F_DTLS1_PROCESS_RECORD, SSL_R_DATA_LENGTH_TOO_LONG);\n        goto f_err;\n    }\n    rr->off = 0;\n    RECORD_LAYER_reset_packet_length(&s->rlayer);\n    return (1);\n f_err:\n    ssl3_send_alert(s, SSL3_AL_FATAL, al);\n err:\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}', 'DEFINE_LHASH_OF(SSL_SESSION)', '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}']