-
Notifications
You must be signed in to change notification settings - Fork 24
test(fuzz): add fuzzing for dpapi-pdu
structures
#412
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
1cf50e2
to
aa8b2c5
Compare
"crates/dpapi-pdu", | ||
"crates/dpapi-fuzzing", | ||
"crates/dpapi-pdu", | ||
"crates/dpapi-fuzzing", |
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.
Duplicated?
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.
Oh, yes. I think I accidentally added it during conflicts resolving
pub fn round_trip(any: AnyStruct) { | ||
let mut buf = WriteBuf::new(); | ||
|
||
if let Ok(name) = any.encode(&mut buf) { | ||
let round_tripped_struct = |
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.
note: Those are called "oracles". I think it would be slightly better to put all the oracles into a oracle
module.
let floor_length = src.read_u16(); | ||
let tower = (0..floor_length) | ||
.map(|_| Floor::decode_owned(src)) | ||
.collect::<DecodeResult<Vec<Floor>>>()?; | ||
|
||
// invalid tower_length can lead to invalid padding and corrupted fields. |
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.
style: Proper sentence for comments:
// invalid tower_length can lead to invalid padding and corrupted fields. | |
// Invalid tower_length can lead to invalid padding and corrupted fields. |
dpapi-fuzzing = { path = "../crates/dpapi-fuzzing" } | ||
libfuzzer-sys = "0.4" | ||
sspi = { path = ".." } |
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.
note:
dpapi-fuzzing = { path = "../crates/dpapi-fuzzing" } | |
libfuzzer-sys = "0.4" | |
sspi = { path = ".." } | |
dpapi-fuzzing.path = "../crates/dpapi-fuzzing" | |
libfuzzer-sys = "0.4" | |
sspi.path = ".." |
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.
LGTM! Good job improving the robustness of the code!
Small note: it’s better for both reviewing and version tracking to open a separate PR for the bug fixes, but it’s not a big deal.
dpapi-pdu
structuresdpapi-pdu
structures
Argh, I didn’t notice it was against another PR branch…! If the intention was to merge this PR later, I think it’s better to mark it as draft to help avoiding this kind of mistakes 🙂 |
Oh, okay. I will take it into account |
This reverts commit 187d6f5.
Hi,
I decided to add fuzzing to
dpapi-pdu
crate. Because we have a lot of decoding/encoding there.It wasn't hard to implement it. It was much harder to fix bugs found by fuzzing.