Files
swift-nio-http2/Sources/NIOHTTP2
Rick Newton-Rogers a6d0d37e2e ContentLengthVerifier init throws on negative values (#361)
Motivation:

We discovered that this code path can result in an arithmetic overflow
in the case where the content-length header has INT_MIN value. Since
negative content-lengths don't have any meaning anyway we may as well
throw if we encounter one so the decoding can be aborted.

Modifications:

* ContentLengthVerifier init throws a `ContentLengthHeaderNegative` error
when the decoded value is < 0.
* ContentLengthVerifier init throws a `ContentLengthHeaderMalformedValue` error
when the value cannot be decoded, e.g. it is out of bounds for Int or is
an invalid string.

Result:

We will no longer panic for INT_MIN content-lengths and will fail
decoding if one of various invalid values is encountered.
2022-11-25 13:41:46 +00:00
..