Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to deserialise incorrectly formatted stream causes stack overflow error #151

Open
alex-ntk opened this issue Mar 14, 2024 · 1 comment
Labels
issue This doesn't seem right V4 candidate Candidate for next major release

Comments

@alex-ntk
Copy link

What is the bug?

Avro deserialiser can cause stack overflow exception when deserialising crafted message.

How to reproduce?

public class TestMessage
{
    public string Body { get; set; }
}

var msg = new TestMessage { Body = "OK" };
var data = AvroConvert.Serialize(msg);
data[5] = 0x67;
var msg2 = AvroConvert.Deserialize<TestMessage>(data); // crashes here

What is the Avro data? Fill up the section or provide a sample file

Base64 data:

T2JqAQRnYXZyby5jb2RlYwhudWxsFmF2cm8uc2NoZW1h2AF7Im5h
bWUiOiJUZXN0TWVzc2FnZSIsIm5hbWVzcGFjZSI6IlRlc3RQcm9qZW
N0MSIsInR5cGUiOiJyZWNvcmQiLCJmaWVsZHMiOlt7Im5hbWUiOiJ
Cb2R5IiwidHlwZSI6InN0cmluZyJ9XX0A7Gd+lRgoLGnc1A0NySGRX
AIGBE9L7Gd+lRgoLGnc1A0NySGRXA==

What is the expected behavior?

throw exception that is easy to catch, not StackOverflow exception.

What could be the reason of the bug?

image

@AdrianStrugala AdrianStrugala added the issue This doesn't seem right label Mar 17, 2024
@AdrianStrugala
Copy link
Owner

Hello,
Thank you for your idea. I will take a look at the exception handling.
Best,
Adrian

@AdrianStrugala AdrianStrugala added the V4 candidate Candidate for next major release label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue This doesn't seem right V4 candidate Candidate for next major release
Projects
None yet
Development

No branches or pull requests

2 participants