File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,11 @@ class TranslateToFuzzReader {
5656public:
5757 TranslateToFuzzReader (Module& wasm, std::string& filename) : wasm(wasm), builder(wasm) {
5858 auto input (read_file<std::vector<char >>(filename, Flags::Binary, Flags::Release));
59- bytes.swap (input);
60- pos = 0 ;
61- finishedInput = false ;
62- // ensure *some* input to be read
63- if (bytes.size () == 0 ) {
64- bytes.push_back (0 );
65- }
59+ readData (input);
60+ }
61+
62+ TranslateToFuzzReader (Module& wasm, std::vector<char > input) : wasm(wasm), builder(wasm) {
63+ readData (input);
6664 }
6765
6866 void pickPasses (OptimizationOptions& options) {
@@ -180,6 +178,17 @@ class TranslateToFuzzReader {
180178 // so it's not identical
181179 int xorFactor = 0 ;
182180
181+
182+ void readData (std::vector<char > input) {
183+ bytes.swap (input);
184+ pos = 0 ;
185+ finishedInput = false ;
186+ // ensure *some* input to be read
187+ if (bytes.size () == 0 ) {
188+ bytes.push_back (0 );
189+ }
190+ }
191+
183192 int8_t get () {
184193 if (pos == bytes.size ()) {
185194 // we ran out of input, go to the start for more stuff
You can’t perform that action at this time.
0 commit comments