-
Notifications
You must be signed in to change notification settings - Fork 265
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
How does CBMC handle padding bytes? #8499
Comments
The C standard, however, also says (C11, 6.7.9 Initialization, paragraph 10)
and then (C11, 6.7.9 Initialization, paragraph 21)
So I am not yet convinced that CBMC is getting this wrong. |
Ah! That's a good point! The part that confuses me is this part of the General section of Representation of types:
So I was expecting that this assignment would generate padding bytes with unspecified values. struct WPad copy = val; |
Compiling the above with clang 14 and gcc 11.4, the following can be observed:
We should make the padding bytes "uninitialized". |
CBMC version: 6.4.0
Operating system: Ubuntu 22.04
Exact command line resulting in the issue: cbmc memcmp.c
What behaviour did you expect: I expected the verification to fail since the memory being compared contains padding bytes. However, CBMC seems to be initializing all the padding bytes with 0s.
What happened instead: Verification succeeded
Example:
From what I can tell, the C spec says that the values of padding bytes are unspecified.
Running the same example using
gcc
with address sanitizer and maybe uninitialized warnings gives me the following result:The text was updated successfully, but these errors were encountered: