Skip to content

Commit 9a3c02f

Browse files
authored
http2_client: fix reader segfault on PROTOCOL_ERRORs (#3926)
1 parent dad518a commit 9a3c02f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/transport/http2_client.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,13 @@ func (t *http2Client) reader() {
13061306
if s != nil {
13071307
// use error detail to provide better err message
13081308
code := http2ErrConvTab[se.Code]
1309-
msg := t.framer.fr.ErrorDetail().Error()
1309+
errorDetail := t.framer.fr.ErrorDetail()
1310+
var msg string
1311+
if errorDetail != nil {
1312+
msg = errorDetail.Error()
1313+
} else {
1314+
msg = "received invalid frame"
1315+
}
13101316
t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false)
13111317
}
13121318
continue

0 commit comments

Comments
 (0)