From a3d130ae5144bc6e8c8099039982269ca2477b2e Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Wed, 31 Jul 2024 18:32:02 +0200 Subject: [PATCH] gracefully handle chunked encoding missing size Treat it the same as invalid characters where size should be. --- gunicorn/http/body.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index 78f03214..3de84c7c 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -91,6 +91,8 @@ class ChunkedReader(object): chunk_size = chunk_size.rstrip(b" \t") if any(n not in b"0123456789abcdefABCDEF" for n in chunk_size): raise InvalidChunkSize(chunk_size) + if len(chunk_size) == 0: + raise InvalidChunkSize(chunk_size) chunk_size = int(chunk_size, 16) if chunk_size == 0: