[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] fuzz/x86emul: print out minimal input size
commit c6a43412d7ce6f57c2997105f635f4c6a38d9de0 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Wed Jan 25 15:35:54 2017 +0000 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Mon Feb 6 10:15:49 2017 +0000 fuzz/x86emul: print out minimal input size ... so that users can know how big the initial input should be. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- .../fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c | 8 ++++++++ tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c index 494c23b..16edbd6 100644 --- a/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c +++ b/tools/fuzz/x86_instruction_emulator/afl-x86-insn-emulator-fuzzer.c @@ -2,8 +2,10 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> extern int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size); +extern unsigned int fuzz_minimal_input_size(void); #define INPUT_SIZE 4096 static uint8_t input[INPUT_SIZE]; @@ -21,6 +23,12 @@ int main(int argc, char **argv) exit(-1); } + if ( !strcmp(argv[1], "--min-input-size") ) + { + printf("%u\n", fuzz_minimal_input_size()); + exit(0); + } + fp = fopen(argv[1], "rb"); if ( fp == NULL ) { diff --git a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c index 22d2d87..3b6d33a 100644 --- a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c +++ b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c @@ -708,6 +708,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size) return 0; } +unsigned int fuzz_minimal_input_size(void) +{ + return DATA_OFFSET + 1; +} + /* * Local variables: * mode: C -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |