Skip to content

Commit e1c0567

Browse files
committed
restrict buffers to be under the LOH size
1 parent 4fa7460 commit e1c0567

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Grpc.Net.Client/Internal/StreamExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ private static Status CreateUnknownMessageEncodingMessageStatus(string unsupport
128128
{
129129
using (var compressionStream = compressionProvider.CreateDecompressionStream(new LimitedLengthStream(responseStream, length)))
130130
{
131-
lastLength = await ReadStreamToBuffers(compressionStream, buffer, moreBuffers, length, cancellationToken).ConfigureAwait(false);
131+
var underLohLength = Math.Min(length, 65536);
132+
lastLength = await ReadStreamToBuffers(compressionStream, buffer, moreBuffers, underLohLength, cancellationToken).ConfigureAwait(false);
132133
}
133134
call.DeserializationContext.SetPayload(BuffersToReadOnlySequence(buffer, moreBuffers, lastLength));
134135
message = deserializer(call.DeserializationContext);

0 commit comments

Comments
 (0)