From 8e9495068e9bb8301be0b27ee8912c215c35c9c9 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 24 Nov 2020 17:02:36 +0000 Subject: [PATCH] h2: ignore unknown frame types a bit earlier Chrome has started being able to issue frame type 0x42, we drop the connection before we realize we wanted to ignore it. This explicitly ignores it a bit earlier. --- lib/roles/h2/http2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index cce4208ee..b598a2047 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -1003,7 +1003,11 @@ lws_h2_parse_frame_header(struct lws *wsi) } } - if (h2n->swsi && h2n->sid && + if (h2n->type >= LWS_H2_FRAME_TYPE_COUNT) + /* we MUST ignore frames we don't understand */ + h2n->type = LWS_H2_FRAME_TYPE_COUNT; + + if (h2n->swsi && h2n->sid && h2n->type != LWS_H2_FRAME_TYPE_COUNT && !(http2_rx_validity[h2n->swsi->h2.h2_state] & (1 << h2n->type))) { lwsl_info("%s: wsi %p, State: %s, ILLEGAL cmdrx %d (OK 0x%x)\n", __func__, h2n->swsi,