@@ -561,6 +561,29 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict,
561
561
return 0 ;
562
562
}
563
563
564
+ Vector<std::string> ParseSeedInuts (const char *seed_inputs) {
565
+ // Parse -seed_inputs=file1,file2,... or -seed_inputs=@seed_inputs_file
566
+ Vector<std::string> Files;
567
+ if (!seed_inputs) return Files;
568
+ std::string SeedInputs;
569
+ if (Flags.seed_inputs [0 ] == ' @' )
570
+ SeedInputs = FileToString (Flags.seed_inputs + 1 ); // File contains list.
571
+ else
572
+ SeedInputs = Flags.seed_inputs ; // seed_inputs contains the list.
573
+ if (SeedInputs.empty ()) {
574
+ Printf (" seed_inputs is empty or @file does not exist.\n " );
575
+ exit (1 );
576
+ }
577
+ // Parse SeedInputs.
578
+ size_t comma_pos = 0 ;
579
+ while ((comma_pos = SeedInputs.find_last_of (' ,' )) != std::string::npos) {
580
+ Files.push_back (SeedInputs.substr (comma_pos + 1 ));
581
+ SeedInputs = SeedInputs.substr (0 , comma_pos);
582
+ }
583
+ Files.push_back (SeedInputs);
584
+ return Files;
585
+ }
586
+
564
587
int FuzzerDriver (int *argc, char ***argv, UserCallback Callback) {
565
588
using namespace fuzzer ;
566
589
assert (argc && argv && " Argument pointers cannot be nullptr" );
@@ -663,6 +686,8 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
663
686
Options.FeaturesDir = Flags.features_dir ;
664
687
Options.LazyCounters = Flags.lazy_counters ;
665
688
689
+ auto ExtraSeedFiles = ParseSeedInuts (Flags.seed_inputs );
690
+
666
691
unsigned Seed = Flags.seed ;
667
692
// Initialize Seed.
668
693
if (Seed == 0 )
@@ -671,6 +696,10 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
671
696
if (Flags.verbosity )
672
697
Printf (" INFO: Seed: %u\n " , Seed);
673
698
699
+ if (Flags.collect_data_flow )
700
+ return CollectDataFlow (Flags.collect_data_flow , Flags.data_flow_trace ,
701
+ *Inputs, ExtraSeedFiles);
702
+
674
703
Random Rand (Seed);
675
704
auto *MD = new MutationDispatcher (Rand, Options);
676
705
auto *Corpus = new InputCorpus (Options.OutputCorpus );
@@ -763,27 +792,6 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
763
792
exit (0 );
764
793
}
765
794
766
- // Parse -seed_inputs=file1,file2,... or -seed_inputs=@seed_inputs_file
767
- Vector<std::string> ExtraSeedFiles;
768
- if (Flags.seed_inputs ) {
769
- std::string SeedInputs;
770
- if (Flags.seed_inputs [0 ] == ' @' )
771
- SeedInputs = FileToString (Flags.seed_inputs + 1 ); // File contains list.
772
- else
773
- SeedInputs = Flags.seed_inputs ; // seed_inputs contains the list.
774
- if (SeedInputs.empty ()) {
775
- Printf (" seed_inputs is empty or @file does not exist.\n " );
776
- exit (1 );
777
- }
778
- // Parse SeedInputs.
779
- size_t comma_pos = 0 ;
780
- while ((comma_pos = SeedInputs.find_last_of (' ,' )) != std::string::npos) {
781
- ExtraSeedFiles.push_back (SeedInputs.substr (comma_pos + 1 ));
782
- SeedInputs = SeedInputs.substr (0 , comma_pos);
783
- }
784
- ExtraSeedFiles.push_back (SeedInputs);
785
- }
786
-
787
795
F->Loop (*Inputs, ExtraSeedFiles);
788
796
789
797
if (Flags.verbosity )
0 commit comments