mirror of
https://github.com/google/flatbuffers.git
synced 2026-08-04 08:34:02 +00:00
Made the memcmp address sanitizer clean.
Added extra check to ensure memcmp gets called with a size that is guaranteed within range of the buffer. This wasn't a real problem, but stops address sanitizer from complaining. See: https://github.com/google/flatbuffers/issues/88 https://github.com/joker-eph/flatbuffers/commit/517506b4e105814e0823353c3d6561085c26a1ab#commitcomment-8265231 Change-Id: I7de24da2d36d973e154f92eeb3e093070886037f Tested: on Linux
This commit is contained in:
@@ -540,7 +540,9 @@ class FlatBufferBuilder {
|
||||
// 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.
|
||||
for (auto it = vtables_.begin(); it != vtables_.end(); ++it) {
|
||||
if (memcmp(buf_.data_at(*it), vt1, vt1_size)) continue;
|
||||
auto vt2 = reinterpret_cast<voffset_t *>(buf_.data_at(*it));
|
||||
auto vt2_size = *vt2;
|
||||
if (vt1_size != vt2_size || memcmp(vt2, vt1, vt1_size)) continue;
|
||||
vt_use = *it;
|
||||
buf_.pop(GetSize() - vtableoffsetloc);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user