dotnet / LLVMSharp

LLVM bindings for .NET Standard written in C# using ClangSharp
MIT License
838 stars 95 forks source link

Use the Count when converting a MarshaledArray to a ReadOnlySpan #189

Closed will14smith closed 1 year ago

will14smith commented 2 years ago

I encountered an error when using BuildGEP saying there were some null elements being passed in.

The ArrayPool can sometimes return a larger array than what was requested, so was causing extra null elements to be passed into the function.

This PR should resolve the issue by setting the expected length of the array into the ReadOnlySpan which will act to limit the length.

tannergooding commented 1 year ago

The implementation was reworked to be a bit different and no longer has this issue.