Skip to content
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

Some bug in receiver when parsing final model #12

Closed
misha1sh opened this issue Jun 22, 2019 · 4 comments
Closed

Some bug in receiver when parsing final model #12

misha1sh opened this issue Jun 22, 2019 · 4 comments

Comments

@misha1sh
Copy link

Hello. Minimal size of final model struct is 8 bytes, but this assert is checking that message_size is larger than 16 bytes

assert((message_size >= (4 + 4 + 4 + 4)) && "Invalid receive data!");

Is this kind of bug or I am just using wrong compilation options?

@chronoxor
Copy link
Owner

8 bytes (4 byte size & 4 bytes offset) is minimal struct size, which could be included into another struct. For root structs which are send / received we need two more fields - 4 bytes total size and 4 bytes offset. See FBE spec for details - https://chronoxor.github.io/FastBinaryEncoding/documents/FBE.html#structs

Root struct

@misha1sh
Copy link
Author

misha1sh commented Jun 22, 2019

In specification said that minimal size of FINAL struct is 8 bytes:

Final model struct properties:

Root struct size = 8 + sizeof(fileds)
Inner struct size = sizeof(fileds)

image

And this assert is working for Final model too. If you pass empty struct to FinalSender and then will try to pass buffer to FinalReceiver, this assert will fail. (model should be compiled with --final and --sender flags). Tested on java

@chronoxor
Copy link
Owner

Reproduced! Fix will be available soon.

@chronoxor
Copy link
Owner

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants