diff options
| author | Alexander Egorenkov <eaibmz@gmail.com> | 2024-07-01 11:44:14 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-07-01 12:31:54 +0000 |
| commit | 76838be540c998a66392d0267d7c9ee3b4a27a46 (patch) | |
| tree | d3c994adb0b17e428fdd1d05c40d195c3df6378a /executor | |
| parent | 371c64443fff4d5d232d48c43d0423fcb1198684 (diff) | |
executor: fix endianess of size of received flatbuffers root table
Flatbuffers represents each scalar in little-endian format
(https://flatbuffers.dev/flatbuffers_internals.html). Therefore,
the size of the received root table must be converted to the host endianness
format before its first usage.
Signed-off-by: Alexander Egorenkov <eaibmz@gmail.com>
Fixes: e16e2c9a4cb6 ("executor: add runner mode")
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/conn.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/executor/conn.h b/executor/conn.h index ace7d187b..ce9e3e7dc 100644 --- a/executor/conn.h +++ b/executor/conn.h @@ -2,6 +2,7 @@ // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. #include <arpa/inet.h> +#include <endian.h> #include <fcntl.h> #include <netdb.h> #include <netinet/in.h> @@ -44,6 +45,7 @@ public: typedef typename Msg::TableType Raw; flatbuffers::uoffset_t size; Recv(&size, sizeof(size)); + size = le32toh(size); recv_buf_.resize(size); Recv(recv_buf_.data(), size); auto raw = flatbuffers::GetRoot<Raw>(recv_buf_.data()); |
