Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix bad stackalloc size after we moved to strongly-typed buffers
  • Loading branch information
jkoritzinsky committed Oct 4, 2022
commit 82393aaca2be41f5aba4e33a095552d7a2f33c4f
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public void FromManaged(List<T> managed, Span<TUnmanagedElement> buffer)

_list = managed;
// Always allocate at least one byte when the list is zero-length.
int spaceToAllocate = Math.Max(managed.Count * sizeof(TUnmanagedElement), 1);
int spaceToAllocate = Math.Max(managed.Count, 1);
if (spaceToAllocate <= buffer.Length)
{
_span = buffer[0..spaceToAllocate];
Expand Down