-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix misalignment of small structs in a Vector (C++) #7883
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2f88628
Rare fix: kick fix test
bexcite 95201bb
Rare fix: real fix
bexcite 507d3ad
Rare fix: separate test
bexcite 54f6099
Rare fix: remove comments
bexcite e65640b
Rare fix: updates
bexcite 934f75f
Rare fix: less
bexcite 8433c16
Rare fix: size_t switch to uoffset_t
bexcite 9a7d0ea
Rare fix: swap exp/val
bexcite f8a8a9d
Rare fix: add annotated before/after
bexcite 2cf39f1
Rare fix: remove unnecessary changes
bexcite 6629340
Merge branch 'master' into pb/fix-rare-fix
dbaileychess 93b9d88
Merge branch 'master' into pb/fix-rare-fix
dbaileychess File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "small_structs": [ | ||
| { | ||
| "var_0": 2, | ||
| "var_1": 1 | ||
| }, | ||
| { | ||
| "var_0": 3, | ||
| "var_1": 1 | ||
| }, | ||
| { | ||
| "var_0": 4, | ||
| "var_1": 1 | ||
| } | ||
| ] | ||
| } | ||
dbaileychess marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Annotated Flatbuffer Binary | ||
| // | ||
| // Schema file: alignment_test.fbs | ||
| // Binary file: alignment_test_after_fix.bin | ||
|
|
||
| header: | ||
| +0x00 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: 0x0C | offset to root table `SmallStructs` | ||
|
|
||
| padding: | ||
| +0x04 | 00 00 | uint8_t[2] | .. | padding | ||
|
|
||
| vtable (SmallStructs): | ||
| +0x06 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable | ||
| +0x08 | 08 00 | uint16_t | 0x0008 (8) | size of referring table | ||
| +0x0A | 04 00 | VOffset16 | 0x0004 (4) | offset to field `small_structs` (id: 0) | ||
|
|
||
| root_table (SmallStructs): | ||
| +0x0C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: 0x06 | offset to vtable | ||
| +0x10 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: 0x14 | offset to field `small_structs` (vector) | ||
|
|
||
| vector (SmallStructs.small_structs): | ||
| +0x14 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items) | ||
| +0x18 | 02 | uint8_t | 0x02 (2) | struct field `[0].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x19 | 01 | uint8_t | 0x01 (1) | struct field `[0].var_1` of 'JustSmallStruct' (UByte) | ||
| +0x1A | 03 | uint8_t | 0x03 (3) | struct field `[1].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x1B | 01 | uint8_t | 0x01 (1) | struct field `[1].var_1` of 'JustSmallStruct' (UByte) | ||
| +0x1C | 04 | uint8_t | 0x04 (4) | struct field `[2].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x1D | 01 | uint8_t | 0x01 (1) | struct field `[2].var_1` of 'JustSmallStruct' (UByte) | ||
|
|
||
| padding: | ||
| +0x1E | 00 00 | uint8_t[2] | .. | padding |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Annotated Flatbuffer Binary | ||
| // | ||
| // Schema file: alignment_test.fbs | ||
| // Binary file: alignment_test_before_fix.bin | ||
|
|
||
| header: | ||
| +0x00 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: 0x0C | offset to root table `SmallStructs` | ||
|
|
||
| padding: | ||
| +0x04 | 00 00 | uint8_t[2] | .. | padding | ||
|
|
||
| vtable (SmallStructs): | ||
| +0x06 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable | ||
| +0x08 | 08 00 | uint16_t | 0x0008 (8) | size of referring table | ||
| +0x0A | 04 00 | VOffset16 | 0x0004 (4) | offset to field `small_structs` (id: 0) | ||
|
|
||
| root_table (SmallStructs): | ||
| +0x0C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: 0x06 | offset to vtable | ||
| +0x10 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: 0x14 | offset to field `small_structs` (vector) | ||
|
|
||
| vector (SmallStructs.small_structs): | ||
| +0x14 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items) | ||
| +0x18 | 00 | uint8_t | 0x00 (0) | struct field `[0].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x19 | 00 | uint8_t | 0x00 (0) | struct field `[0].var_1` of 'JustSmallStruct' (UByte) | ||
| +0x1A | 02 | uint8_t | 0x02 (2) | struct field `[1].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x1B | 01 | uint8_t | 0x01 (1) | struct field `[1].var_1` of 'JustSmallStruct' (UByte) | ||
| +0x1C | 03 | uint8_t | 0x03 (3) | struct field `[2].var_0` of 'JustSmallStruct' (UByte) | ||
| +0x1D | 01 | uint8_t | 0x01 (1) | struct field `[2].var_1` of 'JustSmallStruct' (UByte) | ||
|
|
||
| unknown (no known references): | ||
| +0x1E | 04 01 | ?uint8_t[2] | .. | WARN: could be corrupted padding region. | ||
dbaileychess marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.