-
Notifications
You must be signed in to change notification settings - Fork 274
value sets: do not try to access components of an empty struct/union #5659
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #5659 +/- ##
========================================
Coverage 69.42% 69.42%
========================================
Files 1243 1243
Lines 100632 100633 +1
========================================
+ Hits 69861 69864 +3
+ Misses 30771 30769 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
4234d72
to
bc7f83f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you come up with a test case for this for our regression tests?
I tried, and I'll keep trying, but it seems one has to craft code that does invalid pointer dereferences and perhaps other questionable things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change seems reasonable. I agree with @hannes-steffenhagen-diffblue that a test case would be good. Have you tried https://github.com/csmith-project/creduce ?
This avoids a segmentation fault while running on c/ldv-linux-4.2-rc1/linux-4.2-rc1.tar.xz-32_7a-drivers--staging--lustre--lustre--mdc--mdc.ko-entry_point.cil.out.i with options --pointer-check --bounds-check --unwind 2. This benchmark includes the empty `union __anonunion_u_rpc_386`. The (minimal) regression test was constructed with the help of C-Reduce from the above benchmark.
bc7f83f
to
eade88f
Compare
Ah, of course! Thank you for reminding me!! That did the trick, a tiny regression test is now included. (And, yes, it does involve invalid pointer dereferencing.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better! Thanks.
This avoids a segmentation fault while running on
c/ldv-linux-4.2-rc1/linux-4.2-rc1.tar.xz-32_7a-drivers--staging--lustre--lustre--mdc--mdc.ko-entry_point.cil.out.i
with options --pointer-check --bounds-check --unwind 2. This benchmark
includes the empty
union __anonunion_u_rpc_386
. While the patch doesaddress the problem on this benchmark, I failed to come up with a small
regression test.