[ 
https://issues.apache.org/jira/browse/AVRO-3226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17431148#comment-17431148
 ] 

ASF subversion and git services commented on AVRO-3226:
-------------------------------------------------------

Commit 4e1fefca493029ace961b7ef8889a3722458565a in avro's branch 
refs/heads/branch-1.11 from Philip Sanetra
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=4e1fefc ]

AVRO-3225: AVRO-3226: Fix possible StackOverflowException and 
OutOfMemoryException on invalid input

* AVRO-3225: Fix possible StackOverflowException on invalid input

* AVRO-3226: Fix possible OutOfMemoryException on invalid input

* AVRO-3226: Backport changes for netstandard2.0

(cherry picked from commit a1fce29d9675b4dd95dfee9db32cc505d0b2227c)
Signed-off-by: Ryan Skraba <[email protected]>


> 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
>            Priority: Major
>             Fix For: 1.11.0
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to