-
Notifications
You must be signed in to change notification settings - Fork 22
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
Using $next in conditional fields generates incorrect offsets #206
Comments
Confirming the problem seems to be with $next, as manually calculating the offsets works:
|
Maybe related to #191 @jasongraffius |
I'm not the first to make this mistake with $next looks like, so I do think it should be explicitly called out in the docs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm writing a definition for a protocol where the length field is dynamically sized. I've noted that all the fields after the conditional that pulls the extended length portion out are pointing at the wrong offset. It seems that $next is not doing what one would expect in the presence of a conditional.
Definition:
Everything after
is pointing one byte off, even if the
length_extended_flag != RfcommLengthExtended.EXTENDED
. I confirmed this with a!has_length_extended()
check and looking at theemboss_reserved_local_offset
variable in the generated code for each field.For example one would expect
credits
to have offset3
whenlength_extended_flag != RfcommLengthExtended.EXTENDED
, but it actually has4
.On a related note:
IntrinsicSizeInBytes().Read()
reports one more byte than I would expect on this struct as well. Like it isn't taking into account the conditionals correctly.There's some messy code that uses the generated stuff here for more context https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/246974
The text was updated successfully, but these errors were encountered: