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

Missing check of size and alignment of opaque fields #288

Closed
treiher opened this issue Jun 15, 2020 · 4 comments · Fixed by #327
Closed

Missing check of size and alignment of opaque fields #288

treiher opened this issue Jun 15, 2020 · 4 comments · Fixed by #327
Assignees
Labels
bug model Related to model package (e.g., model verification)

Comments

@treiher
Copy link
Collaborator

treiher commented Jun 15, 2020

The generated getters and setters for opaque fields assume that the field is byte-aligned and its bit length is a multiple of 8. This is currently not ensured. Getters and setters for opaque fields should be only generated if these assumptions are met. We should check that in the model.

@treiher treiher added bug generator Related to generator package (SPARK code generation) labels Jun 15, 2020
@treiher treiher added this to To do in RecordFlux 0.4.1 Jun 15, 2020
@senier
Copy link
Member

senier commented Jun 15, 2020

Getters and setters for opaque fields should be only generated if these assumptions are met.

Shouldn't we just reject the model in such cases? Do we know of examples that have non-byte-aligned opaque fields?

@treiher
Copy link
Collaborator Author

treiher commented Jun 15, 2020

You are right. I thought there would be an example, but I couldn't find one. So we should check that in the model.

@treiher treiher added model Related to model package (e.g., model verification) and removed generator Related to generator package (SPARK code generation) labels Jun 15, 2020
@jklmnn
Copy link
Member

jklmnn commented Jun 15, 2020

Even if there were examples. How would we write and read the fields without getters and setters?

Aside from that the properties to prove the length was:

First mod 8 = 1
Length mod 8 = 0

This also requires that the message itself is also byte aligned. If this is not the case the First_Bit_Index and Last_Bit_Index are not reversible with Byte_Index which is required.

@treiher
Copy link
Collaborator Author

treiher commented Jun 15, 2020

This also requires that the message itself is also byte aligned.

That is true. I cannot see a way to misalign a message as soon as the alignment is checked for opaque fields.

@senier senier self-assigned this Jun 18, 2020
@senier senier moved this from To do to In progress in RecordFlux 0.4.1 Jun 29, 2020
@treiher treiher changed the title Getters and setters for opaque fields Missing check of size and alignment of opaque fields Jul 1, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
senier pushed a commit that referenced this issue Jul 8, 2020
RecordFlux 0.4.1 automation moved this from In progress to Done Jul 9, 2020
senier pushed a commit that referenced this issue Jul 9, 2020
senier pushed a commit that referenced this issue Jul 9, 2020
@treiher treiher mentioned this issue Jul 14, 2020
4 tasks
treiher pushed a commit that referenced this issue Jul 23, 2020
treiher pushed a commit that referenced this issue Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug model Related to model package (e.g., model verification)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants