comparison src/event/ngx_event_quic.c @ 7922:d437ee1ce81e quic

Reject invalid STREAM ID with STREAM_STATE_ERROR connection error.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 05 Jun 2020 20:59:26 +0300
parents c70446e3d771
children 953cf44708b0
comparison
equal deleted inserted replaced
7921:6ea2f1daedb5 7922:d437ee1ce81e
2596 ngx_quic_frames_stream_t *fs; 2596 ngx_quic_frames_stream_t *fs;
2597 2597
2598 qc = c->quic; 2598 qc = c->quic;
2599 f = &frame->u.stream; 2599 f = &frame->u.stream;
2600 2600
2601 if ((f->stream_id & NGX_QUIC_STREAM_UNIDIRECTIONAL)
2602 && (f->stream_id & NGX_QUIC_STREAM_SERVER_INITIATED))
2603 {
2604 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR;
2605 return NGX_ERROR;
2606 }
2607
2601 sn = ngx_quic_find_stream(&qc->streams.tree, f->stream_id); 2608 sn = ngx_quic_find_stream(&qc->streams.tree, f->stream_id);
2602 2609
2603 if (sn == NULL) { 2610 if (sn == NULL) {
2604 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, 2611 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
2605 "quic stream id 0x%xi is new", f->stream_id); 2612 "quic stream id 0x%xi is new", f->stream_id);
2613
2614 if (f->stream_id & NGX_QUIC_STREAM_SERVER_INITIATED) {
2615 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR;
2616 return NGX_ERROR;
2617 }
2606 2618
2607 n = (f->stream_id & NGX_QUIC_STREAM_UNIDIRECTIONAL) 2619 n = (f->stream_id & NGX_QUIC_STREAM_UNIDIRECTIONAL)
2608 ? qc->tp.initial_max_stream_data_uni 2620 ? qc->tp.initial_max_stream_data_uni
2609 : qc->tp.initial_max_stream_data_bidi_remote; 2621 : qc->tp.initial_max_stream_data_bidi_remote;
2610 2622