Skip to content
Open
Changes from all commits
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
4 changes: 3 additions & 1 deletion net/FlatBuffers/Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public T[] __vector_as_array<T>(int offset)

var pos = this.__vector(o);
var len = this.__vector_len(o);
return bb.ToArray<T>(pos, len);
// Fix memory alignment issue: calculate correct byte length (element count × element size)
var byteLen = len * System.Runtime.InteropServices.Marshal.SizeOf<T>();
return bb.ToArray<T>(pos, byteLen);
}

// Initialize any Table-derived type to point to the union at the given offset.
Expand Down
Loading