Philip Sanetra created AVRO-3226:
------------------------------------
Summary: OutOfMemoryException on invalid input for
BinaryDecoder.ReadString on NetStandard 2.1+
Key: AVRO-3226
URL: https://issues.apache.org/jira/browse/AVRO-3226
Project: Apache Avro
Issue Type: Bug
Components: csharp
Reporter: Philip Sanetra
The BinaryDecoder.ReadString() method on NetStandard2.1+ produces an
OutOfMemoryException if there is invalid input caused by this code:
{code:c#}
int length = ReadInt();
Span<byte> buffer = length <= StackallocThreshold ? stackalloc byte[length] :
(bufferArray = ArrayPool<byte>.Shared.Rent(length)).AsSpan(0,
length);
{code}
ArrayPool<byte>.Shared.Rent(length) will cause the exception if ReadInt()
returns a big number like int.MaxValue.
Related to [AVRO-3225|https://issues.apache.org/jira/browse/AVRO-3225]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)