summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBjörn Harrtell <bjornharrtell@users.noreply.github.com>2021-02-23 18:34:20 +0100
committerGitHub <noreply@github.com>2021-02-23 09:34:20 -0800
commitcbbbaa61b34c31f17773c2fef354c31664e9562e (patch)
treefcd7e13a98f401046c37835a3c0bf0cf1a4f6f65 /net
parentffc2ef77caeb6b04e89db952c65216982db44698 (diff)
downloadflatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.tar.gz
flatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.tar.bz2
flatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.zip
[C#] Fix truncated ArraySegment<byte> if elementSize != 1 (#6462)
* WIP: Fix returned truncated ArraySegment<byte> if elementSize is not byte * Fix * Regenerated test code
Diffstat (limited to 'net')
-rw-r--r--net/FlatBuffers/Table.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/FlatBuffers/Table.cs b/net/FlatBuffers/Table.cs
index d888de59..fb3b1adc 100644
--- a/net/FlatBuffers/Table.cs
+++ b/net/FlatBuffers/Table.cs
@@ -112,7 +112,7 @@ namespace FlatBuffers
// Get the data of a vector whoses offset is stored at "offset" in this object as an
// ArraySegment&lt;byte&gt;. If the vector is not present in the ByteBuffer,
// then a null value will be returned.
- public ArraySegment<byte>? __vector_as_arraysegment(int offset)
+ public ArraySegment<byte>? __vector_as_arraysegment(int offset, int elementSize)
{
var o = this.__offset(offset);
if (0 == o)
@@ -122,7 +122,7 @@ namespace FlatBuffers
var pos = this.__vector(o);
var len = this.__vector_len(o);
- return bb.ToArraySegment(pos, len);
+ return bb.ToArraySegment(pos, len * elementSize);
}
#endif