We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If a simple fuzzer is created:
struct TestFuzzer(); impl Fuzzer for TestFuzzer { fn fuzz_packet(&self, frame_data: &mut [u8]) { println!("{:02x?}", frame_data); } }
...and used with a FuzzInjector:
FuzzInjector
let device = FuzzInjector::new(device, TestFuzzer(), TestFuzzer());
...then the bytes of the received packets are printed, but the buffer for transmitted data is always blank at the time that fuzz_packet gets called.
fuzz_packet
[00, 00, 00, 00, 00, 00, 00, 00, ...
This seems to be because fuzz_packet() is called before f() in the TxToken implementation.
fuzz_packet()
f()
TxToken
If the order is reversed, then the buffer contains data as expected.
--- a/src/phy/fuzz_injector.rs +++ b/src/phy/fuzz_injector.rs @@ -123,8 +123,9 @@ impl<'a, Tx: phy::TxToken, FTx: Fuzzer> phy::TxToken for TxToken<'a, Tx, FTx> { { let Self { fuzzer, token } = self; token.consume(timestamp, len, |mut buf| { + let result = f(buf); fuzzer.fuzz_packet(&mut buf); - f(buf) + result }) } }
Disclaimer: I'm quite new to Rust, and haven't properly tested this patch. It works for my project, but it's possible I'm misunderstanding something.
The text was updated successfully, but these errors were encountered:
41667f8
No branches or pull requests
If a simple fuzzer is created:
...and used with a
FuzzInjector
:...then the bytes of the received packets are printed, but the buffer for transmitted data is always blank at the time that
fuzz_packet
gets called.This seems to be because
fuzz_packet()
is called beforef()
in theTxToken
implementation.If the order is reversed, then the buffer contains data as expected.
Disclaimer: I'm quite new to Rust, and haven't properly tested this patch. It works for my project, but it's possible I'm misunderstanding something.
The text was updated successfully, but these errors were encountered: