LLVMSharp icon indicating copy to clipboard operation
LLVMSharp copied to clipboard

Use the Count when converting a MarshaledArray to a ReadOnlySpan

Open will14smith opened this issue 3 years ago • 0 comments

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.

will14smith avatar Feb 15 '22 23:02 will14smith