gracefully handle chunked encoding missing size

Treat it the same as invalid characters where size should be.
This commit is contained in:
Paul J. Dorn 2024-07-31 18:32:02 +02:00
parent 79b9a52cc8
commit a3d130ae51

View File

@ -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: