Skip to content

Commit

Permalink
http2_client: fix reader segfault on PROTOCOL_ERRORs
Browse files Browse the repository at this point in the history
http2.Framer ErrorDetail() might return nil even in case of
http2.StreamError, as documented.
  • Loading branch information
sorah committed Oct 4, 2020
1 parent b2c5f4a commit 275719c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/transport/http2_client.go
Expand Up @@ -1306,7 +1306,11 @@ 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()
msg := ""
if errorDetail != nil {
msg = errorDetail.Error()
}
t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false)
}
continue
Expand Down

0 comments on commit 275719c

Please sign in to comment.