From d426890b92f976108f91bdc4482a15fc2e08f919 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Wed, 22 Oct 2014 13:35:24 -0700 Subject: [PATCH] Fixed big-endian issue. Noticed a memory read that isn't big-endian safe. Was somewhat benign in that it would have simply caused vtable duplication when constructing a FlatBuffer on a big-endian machine. Change-Id: I5de3a2bb3ce6912fdd845ed40668719794920cac --- include/flatbuffers/flatbuffers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index ddbdef9e0..13b0d0e38 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -522,7 +522,7 @@ class FlatBufferBuilder { } offsetbuf_.clear(); auto vt1 = reinterpret_cast(buf_.data()); - auto vt1_size = *vt1; + auto vt1_size = ReadScalar(vt1); auto vt_use = GetSize(); // See if we already have generated a vtable with this exact same // layout before. If so, make it point to the old one, remove this one.