Skip to content

Commit 3d8cac8

Browse files
committed
Validate that maxBodySize is positive
1 parent f0947e9 commit 3d8cac8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/AsyncHTTPClient/HTTPHandler.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ public final class ResponseAccumulator: HTTPClientResponseDelegate {
387387
/// - precondition: not allowed to exceed 2^32 because ``ByteBuffer`` can not store more bytes
388388
public var maxBodySize: Int = maxByteBufferSize {
389389
didSet {
390+
precondition(self.maxBodySize >= 0, "maxBodyLength is not allowed to be negative")
390391
precondition(
391392
self.maxBodySize <= Self.maxByteBufferSize,
392393
"maxBodyLength is not allowed to exceed 2^32 because ByteBuffer can not store more bytes"

0 commit comments

Comments
 (0)