From debaa04f9e249f6bf75d40f38b34cfdcd7fc2047 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 20 Jun 2022 15:47:46 +0200 Subject: [PATCH] BUG/MINOR: qpack: abort on dynamic index field line decoding Add an ABORT_NOW() clause if indexed field line referred to the dynamic table. This is required as current haproxy QPACK implementation does not support the dynamic table. Note that this should not happen as haproxy explicitely advertizes a null-sized dynamic table to the other peer. This shoud fix github issue #1753. No need to backport as this was introduced by commit b666c6b26eae3f17eee058eb6bcc9fe1b1c304d2 MINOR: qpack: improve decoding function --- src/qpack-dec.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qpack-dec.c b/src/qpack-dec.c index bb960b4b94..09ec66d675 100644 --- a/src/qpack-dec.c +++ b/src/qpack-dec.c @@ -289,10 +289,10 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp, else if (efl_type & QPACK_IFL_BIT) { /* Indexed field line */ uint64_t index; - unsigned int t; + unsigned int static_tbl; qpack_debug_printf(stderr, "indexed field line:"); - t = efl_type & 0x40; + static_tbl = efl_type & 0x40; index = qpack_get_varint(&raw, &len, 6); if (len == (uint64_t)-1) { qpack_debug_printf(stderr, "##ERR@%d\n", __LINE__); @@ -300,10 +300,19 @@ int qpack_decode_fs(const unsigned char *raw, size_t len, struct buffer *tmp, goto out; } - if (t) { + if (static_tbl) { name = qpack_sht[index].n; value = qpack_sht[index].v; } + else { + /* TODO not implemented + * + * For the moment, this should never happen as + * currently we do not support dynamic table insertion + * and specify an empty table size. + */ + ABORT_NOW(); + } qpack_debug_printf(stderr, " t=%d index=%llu", !!t, (unsigned long long)index); }