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

fixes a bug in the method that computes C padding. #1308

Merged
merged 1 commit into from
May 7, 2021

Conversation

ivg
Copy link
Member

@ivg ivg commented May 7, 2021

For some reason the code assumes that x mod m is multitude of
m and raises an exception when it doesn't happen (quite often in
fact).

The code is called when a structure size is computed. The main caveat
here is that

  1. this method has incorrect type as it constrains the padding size to
    be in the set of 8,16,32,64,128,256 but real padding may have any
    number of bits (it is their sum that should in this range).
  2. this method shouldn't exist at all as the padding is fully defined
    by the alignment of the field and there is no need to override it.

Therefore, the solution is to deprecated this method and compute
padding using the alignment information only. The method is no longer
used and any code that overrode it will get a warning.

For some reason the code assumes that `x mod m` is multitude of
`m` and raises an exception when it doesn't happen (quite often in
fact).

The code is called when a structure size is computed. The main caveat
here is that
1) this method has incorrect type as it constrains the padding size to
be in the set of `8,16,32,64,128,256` but real padding may have any
number of bits (it is their sum that should in this range).
2) this method shouldn't exist at all as the padding is fully defined
by the alignment of the field and there is no need to override it.

Therefore, the solution is to deprecated this method and compute
padding using the alignment information only. The method is no longer
used and any code that overrode it will get a warning.
@ivg ivg merged commit 2f38fb4 into BinaryAnalysisPlatform:master May 7, 2021
@ivg ivg deleted the fixes-padding-computation branch December 1, 2021 19:17
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

Successfully merging this pull request may close these issues.

1 participant