Skip to content

Incorrect values added by CreateVectorOfStructs() when the vector parameter has an odd size [C++, clang 15, OS X, 22.9.24 and later] #8117

@nolen777

Description

@nolen777

When I call FlatBufferBuilder::CreateVectorOfStructs() passing in a vector with an odd number of entries, the created vector always has zero values in the first entry.

I believe this is a regression in 72aa85a

I've created a small repro case at https://github.com/nolen777/flatbuffers-test

To reproduce:

  1. Clone https://github.com/nolen777/flatbuffers-test
  2. bazel test --test_output=errors //src/main/cpp:test

The test is just checking that the entries in the FB are the same as the entries in the original vector.

If you change the argument vector to have an even number of entries (comment out line 22 and un-comment line 19 in src/main/cpp/test.cpp), the test passes. If you change the WORKSPACE file to the previous commit, the test passes. But on commit 72aa85a or later with an odd number of entries, the test fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions