]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h3: report error on HEADERS/DATA parsing
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Feb 2022 16:30:27 +0000 (17:30 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Feb 2022 16:33:21 +0000 (17:33 +0100)
Inspect return code of HEADERS/DATA parsing functions and use a BUG_ON
to signal an error. The stream should be closed to handle the error
in a more clean fashion.

src/h3.c

index b9e4d5e5a58fa06d51f470c135836c044af739f7..7cecb5de7f76e0e1abf62901c8f4847469b98f73 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -231,6 +231,7 @@ static int h3_data_to_htx(struct qcs *qcs, struct buffer *buf, uint64_t len,
 static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
 {
        struct buffer *rxbuf = &qcs->rx.buf;
+       int ret;
 
        h3_debug_printf(stderr, "%s: STREAM ID: %llu\n", __func__, qcs->by_id.key);
        if (!b_data(rxbuf))
@@ -261,10 +262,14 @@ static int h3_decode_qcs(struct qcs *qcs, int fin, void *ctx)
 
                switch (ftype) {
                case H3_FT_DATA:
-                       h3_data_to_htx(qcs, rxbuf, flen, last_stream_frame);
+                       ret = h3_data_to_htx(qcs, rxbuf, flen, last_stream_frame);
+                       /* TODO handle error reporting. Stream closure required. */
+                       BUG_ON(ret);
                        break;
                case H3_FT_HEADERS:
-                       h3_headers_to_htx(qcs, rxbuf, flen, last_stream_frame);
+                       ret = h3_headers_to_htx(qcs, rxbuf, flen, last_stream_frame);
+                       /* TODO handle error reporting. Stream closure required. */
+                       BUG_ON(ret);
                        break;
                case H3_FT_PUSH_PROMISE:
                        /* Not supported */