From 90595f321a7bb27bd752633985930132e367a18a Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 25 Nov 2019 20:22:00 -0800 Subject: [PATCH] bug(cloudflared): nil pointer deference on h2DictWriter Close() Unlike other h2DictWriter methods, the Close() method does check whether w.comp is nil. This PR adds a check for non nil compressor before attempting to close Bug: #141 --- h2mux/h2_dictionaries.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/h2mux/h2_dictionaries.go b/h2mux/h2_dictionaries.go index bd091894..bf92d58d 100644 --- a/h2mux/h2_dictionaries.go +++ b/h2mux/h2_dictionaries.go @@ -542,7 +542,10 @@ func (w *h2DictWriter) Write(p []byte) (n int, err error) { } func (w *h2DictWriter) Close() error { - return w.comp.Close() + if w.comp != nil { + return w.comp.Close() + } + return nil } // From http2/hpack