-
Notifications
You must be signed in to change notification settings - Fork 7
use uninitialized output buffers for the fuzzers #112
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 ReportAll modified and coverable lines are covered by tests ✅
Flags with carried forward coverage won't be shown. Click here to find out more. see 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
unsafe { output.set_len(usize::try_from(total).unwrap()) }; | ||
|
||
// Just check that this byte is in fact initialized. | ||
_ = output.last() == Some(&0); |
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.
_ = output.last() == Some(&0); | |
std::hint::black_box(output.last() == Some(&0)); |
otherwise it will be optimized away, which would probably cause asan to not catch uninitialized memory.
unsafe { output.set_len(usize::try_from(total).unwrap()) }; | ||
|
||
// Just check that this byte is in fact initialized. | ||
_ = output.last() == Some(&0); |
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.
Same
we previously missed a bug in zlib-rs due to only using initialized output buffers
03e5689
to
f6c91a5
Compare
Just as a note: currently the fuzzer probably won't catch uninitialized memory. For that, we'd need 1) a much more recent version of |
we previously missed a bug in zlib-rs due to only using initialized output buffers. Now we use initialized buffers at least in some places. Because bzip2 doesn't use SIMD, it should never read from these buffers anyway. In effect we test now that the total number of bytes that was written is actually correct.
cc @ros-cr