[
https://issues.apache.org/jira/browse/AVRO-3225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Philip Sanetra updated AVRO-3225:
---------------------------------
Description:
The BinaryDecoder.ReadString() method on NetStandard2.1+ produces a stack
overflow exception if there is invalid input caused by this code:
{code:java}
int length = ReadInt();
Span<byte> buffer = length <= StackallocThreshold ? stackalloc byte[length] :
(bufferArray = ArrayPool<byte>.Shared.Rent(length)).AsSpan(0,
length);
{code}
This code fails if ReadInt() returns a negative value.
was:
The BinaryDecoder.ReadString() method on NetStandard2.1+ produces a stack
overflow exception if there is invalid input caused by this code:
{code:java}
int length = ReadInt();
Span<byte> buffer = length <= StackallocThreshold ? stackalloc byte[length] :
(bufferArray = ArrayPool<byte>.Shared.Rent(length)).AsSpan(0,
length);
{code}
This code fails if ReadInt() returns a negative value.
Related PR: https://github.com/apache/avro/pull/1357
> Stack overflow exception on invalid input for BinaryDecoder.ReadString on
> NetStandard 2.1+
> ------------------------------------------------------------------------------------------
>
> Key: AVRO-3225
> URL: https://issues.apache.org/jira/browse/AVRO-3225
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp
> Reporter: Philip Sanetra
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The BinaryDecoder.ReadString() method on NetStandard2.1+ produces a stack
> overflow exception if there is invalid input caused by this code:
>
> {code:java}
> int length = ReadInt();
> Span<byte> buffer = length <= StackallocThreshold ? stackalloc byte[length] :
> (bufferArray = ArrayPool<byte>.Shared.Rent(length)).AsSpan(0,
> length);
> {code}
>
> This code fails if ReadInt() returns a negative value.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)