[PATCH 2 of 2] QUIC: improved split frames error handling

Sergey Kandaurov pluknet at nginx.com
Mon May 1 15:26:15 UTC 2023


# HG changeset patch
# User Sergey Kandaurov <pluknet at nginx.com>
# Date 1682954724 -14400
#      Mon May 01 19:25:24 2023 +0400
# Branch quic
# Node ID b10aa30b15a802870eb23716ce3937a1085c4c98
# Parent  8aa3363bc83d4354b3142e3972cce5c0ef523539
QUIC: improved split frames error handling.

Do not update frame data chain on ngx_quic_read_buffer() error.
It may be used later as part of error handling, which envolves
writing CONNECTION_CLOSE and pending frames, including the one
with the corrupted chain pointer.  Since ngx_quic_read_buffer()
returns the original chain, there is no point in updating it,
so this was simplified.

diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_quic_frames.c
--- a/src/event/quic/ngx_event_quic_frames.c
+++ b/src/event/quic/ngx_event_quic_frames.c
@@ -359,8 +359,7 @@ ngx_quic_split_frame(ngx_connection_t *c
     ngx_memzero(&qb, sizeof(ngx_quic_buffer_t));
     qb.chain = f->data;
 
-    f->data = ngx_quic_read_buffer(c, &qb, of->length);
-    if (f->data == NGX_CHAIN_ERROR) {
+    if (ngx_quic_read_buffer(c, &qb, of->length) == NGX_CHAIN_ERROR) {
         return NGX_ERROR;
     }
 


More information about the nginx-devel mailing list