|
| 1 | +From db9b39ea4a35a9367797791c4da2d2f0bf700775 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Konnyaku <beifengxuanxiao@126.com> |
| 3 | +Date: Tue, 17 Feb 2026 21:23:54 +0800 |
| 4 | +Subject: [PATCH] http2: fix nil panic in typeFrameParser for unassigned frame |
| 5 | + types |
| 6 | + |
| 7 | +The addition of FramePriorityUpdate (0x10) in RFC 9218 introduced a gap |
| 8 | +in the frameParsers array indices (0x0a-0x0f). These indices were |
| 9 | +initialized to nil, causing a panic when typeFrameParser accessed them |
| 10 | +for unassigned frame types (e.g., ALTSVC 0x0a). |
| 11 | + |
| 12 | +This change adds a nil check in typeFrameParser to safely fallback to |
| 13 | +parseUnknownFrame for these unassigned types, preventing the crash. |
| 14 | + |
| 15 | +Fixes golang/go#77652 |
| 16 | + |
| 17 | +Change-Id: I14d7ad85afc1eafabc46417a9fff10f9e0a22446 |
| 18 | +Reviewed-on: https://go-review.googlesource.com/c/net/+/746180 |
| 19 | +LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> |
| 20 | +Reviewed-by: Damien Neil <dneil@google.com> |
| 21 | +Auto-Submit: Damien Neil <dneil@google.com> |
| 22 | +Reviewed-by: Mark Freeman <markfreeman@google.com> |
| 23 | +Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> |
| 24 | +Upstream-reference: https://github.com/golang/net/commit/19f580fd686a6bb31d4af15febe789827169bc26.patch |
| 25 | +--- |
| 26 | + vendor/golang.org/x/net/http2/frame.go | 4 +++- |
| 27 | + 1 file changed, 3 insertions(+), 1 deletion(-) |
| 28 | + |
| 29 | +diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go |
| 30 | +index db3264d..4642564 100644 |
| 31 | +--- a/vendor/golang.org/x/net/http2/frame.go |
| 32 | ++++ b/vendor/golang.org/x/net/http2/frame.go |
| 33 | +@@ -139,7 +139,9 @@ var frameParsers = [...]frameParser{ |
| 34 | + |
| 35 | + func typeFrameParser(t FrameType) frameParser { |
| 36 | + if int(t) < len(frameParsers) { |
| 37 | +- return frameParsers[t] |
| 38 | ++ if f := frameParsers[t]; f != nil { |
| 39 | ++ return f |
| 40 | ++ } |
| 41 | + } |
| 42 | + return parseUnknownFrame |
| 43 | + } |
| 44 | +-- |
| 45 | +2.45.4 |
| 46 | + |
0 commit comments