chronoxor / FastBinaryEncoding

Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift
https://chronoxor.github.io/FastBinaryEncoding
MIT License
827 stars 86 forks source link

MemoryStream Set: incorrect get size and write to buffer causes exception (C# generator) #71

Closed BlackTr closed 2 years ago

BlackTr commented 2 years ago

E.g. we have input stream with Length = 100 and Capacity = 1000.

public override void Set(MemoryStream value)
...
uint fbeBytesSize = (uint)value.Length; // here we have 100
...
Write(fbeBytesOffset + 4, value.GetBuffer()); // and trying to write 1000

Proposed solution (to c# generator)?

 Write(fbeBytesOffset + 4, value.GetBuffer(), 0, fbeBytesSize);
chronoxor commented 2 years ago

Thanks for reporting! Fixed in 1.11.0.0

BlackTr commented 2 years ago

Thank you!