-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] Rare bad buffer content alignment if sizeof(T) != alignof(T) #7520
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@dbaileychess Could you review this PR please? I fixed the issue by adding alignment parameters to functions calling StartVector. Additionally, I spotted several expressions in the codebase of the form |
@Naios You need to add your new file to the bazel build rule, its failing CI: https://github.com/google/flatbuffers/blob/master/tests/BUILD.bazel#L7 |
Generally looks good to me. |
@dbaileychess Thank you for your review, I have fixed the outstanding changes and optimizations. |
… the bazel CI.
… the bazel CI.
@dbaileychess From my side this PR is finished, do you know why workflow "buildkite/flatbuffers/pr" is failing without any useful output? |
Build kite error:
Looks like you placed the deps out of alphanumeric order. |
The fuzzer build is failing too, looks like due to stricter warnings on the deprecated method. Can you see if the deprecated method is being used in the fuzzer to fix it? |
… the bazel CI.
…t alignment if sizeof(T) != alignof(T))
* A struct can have an arbitrary size and therefore sizeof(struct) == alignof(struct) does not hold anymore as for value primitives. * This patch fixes this by introducing alignment parameters to various CreateVector*/StartVector calls. * Closes google#7516
@dbaileychess I probably have fixed the remaining issues, could you approve the outstanding workflows again please? |
Thanks a bunch! |
…oogle#7520) * [C++] Add a failing unit test for google#7516 (Rare bad buffer content alignment if sizeof(T) != alignof(T)) * [C++] Fix final buffer alignment when using an array of structs * A struct can have an arbitrary size and therefore sizeof(struct) == alignof(struct) does not hold anymore as for value primitives. * This patch fixes this by introducing alignment parameters to various CreateVector*/StartVector calls. * Closes google#7516
…oogle#7520) * [C++] Add a failing unit test for google#7516 (Rare bad buffer content alignment if sizeof(T) != alignof(T)) * [C++] Fix final buffer alignment when using an array of structs * A struct can have an arbitrary size and therefore sizeof(struct) == alignof(struct) does not hold anymore as for value primitives. * This patch fixes this by introducing alignment parameters to various CreateVector*/StartVector calls. * Closes google#7516
EDIT: Fix for #7516, see below