mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-02 18:27:46 +00:00
* fix(go/grpc): avoid panic on short FlatBuffers input The gRPC codec read the root UOffsetT without checking input size. On buffers shorter than SizeUOffsetT, GetUint32 touched data[3] and the process panics. Add a simple length check and validate the root offset stays within the buffer. Return clear errors (insufficient data / invalid root offset) instead of panicking. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi> * fix(go/grpc): avoid signed overflow in offset Keep the bounds check in the unsigned domain (UOffsetT) to avoid signedness pitfalls. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi> * 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> --------- Signed-off-by: Ville Vesilehto <ville@vesilehto.fi> Co-authored-by: Derek Bailey <derekbailey@google.com> |
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| builder.go | ||
| doc.go | ||
| encode.go | ||
| grpc.go | ||
| lib.go | ||
| sizes.go | ||
| struct.go | ||
| table.go | ||