From f1d11efe14a48b5347b8e21022c10df4fb47bace Mon Sep 17 00:00:00 2001 From: Jeff Hunter Date: Tue, 9 Jun 2020 13:18:29 -0700 Subject: [PATCH] http: fix infinite loop hang with invalid gzip data --- tornado/http1connection.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tornado/http1connection.py b/tornado/http1connection.py index ac7170f7d..835027b47 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -737,6 +737,10 @@ class _GzipMessageDelegate(httputil.HTTPMessageDelegate): if ret is not None: await ret compressed_data = self._decompressor.unconsumed_tail + if compressed_data and not decompressed: + raise httputil.HTTPInputError( + "encountered unconsumed gzip data without making progress" + ) else: ret = self._delegate.data_received(chunk) if ret is not None: -- 2.47.2