Skip to content

Commit 487aab9

Browse files
committed
chore: clarify comment regarding offset
A full FlatBuffer structure would be: - uoffset_t: root table offset (4 bytes) - soffset_t: vtable offset in root table (4 bytes) - uint16_t: vtable size (2 bytes) - uint16_t: table size (2 bytes) In total 12 bytes. We are only validating the data length before trying to read the uoffset_t, not the full structure. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
1 parent 2e579e0 commit 487aab9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

go/grpc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ func (FlatbuffersCodec) Marshal(v interface{}) ([]byte, error) {
2525

2626
// Unmarshal parses the wire format into v.
2727
func (FlatbuffersCodec) Unmarshal(data []byte, v interface{}) error {
28-
// Need at least 4 bytes to read the root UOffsetT
28+
// Need at least 4 bytes to read the root table offset (UOffsetT).
29+
// Vtable soffset_t and metadata are read later during field access.
2930
if len(data) < SizeUOffsetT {
3031
return ErrInsufficientData
3132
}

0 commit comments

Comments
 (0)