Skip to content

Commit

Permalink
http2_client: fix reader segfault on PROTOCOL_ERRORs (#3926)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorah committed Oct 6, 2020
1 parent dad518a commit 9a3c02f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/transport/http2_client.go
Expand Up @@ -1306,7 +1306,13 @@ func (t *http2Client) reader() {
if s != nil {
// use error detail to provide better err message
code := http2ErrConvTab[se.Code]
msg := t.framer.fr.ErrorDetail().Error()
errorDetail := t.framer.fr.ErrorDetail()
var msg string
if errorDetail != nil {
msg = errorDetail.Error()
} else {
msg = "received invalid frame"
}
t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false)
}
continue
Expand Down

0 comments on commit 9a3c02f

Please sign in to comment.