mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 19:13:57 +00:00
[C++] Fix vtable deduplication for 64-bit buffers >2GB (#8591)
Fixes #8590
This commit is contained in:
@@ -469,8 +469,8 @@ class FlatBufferBuilderImpl {
|
|||||||
if (dedup_vtables_) {
|
if (dedup_vtables_) {
|
||||||
for (auto it = buf_.scratch_data(); it < buf_.scratch_end();
|
for (auto it = buf_.scratch_data(); it < buf_.scratch_end();
|
||||||
it += sizeof(uoffset_t)) {
|
it += sizeof(uoffset_t)) {
|
||||||
auto vt_offset_ptr = reinterpret_cast<uoffset_t*>(it);
|
auto vt_offset_ptr = reinterpret_cast<uoffset_t *>(it);
|
||||||
auto vt2 = reinterpret_cast<voffset_t*>(buf_.data_at(*vt_offset_ptr));
|
auto vt2 = reinterpret_cast<voffset_t *>(buf_.data_at(*vt_offset_ptr + length_of_64_bit_region_));
|
||||||
auto vt2_size = ReadScalar<voffset_t>(vt2);
|
auto vt2_size = ReadScalar<voffset_t>(vt2);
|
||||||
if (vt1_size != vt2_size || 0 != memcmp(vt2, vt1, vt1_size)) continue;
|
if (vt1_size != vt2_size || 0 != memcmp(vt2, vt1, vt1_size)) continue;
|
||||||
vt_use = *vt_offset_ptr;
|
vt_use = *vt_offset_ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user