MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / read_file

Function read_file

src/test/fuzz/fuzz.cpp:183–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182#if defined(PROVIDE_FUZZ_MAIN_FUNCTION) && !defined(__AFL_LOOP)
183static bool read_file(fs::path p, std::vector<uint8_t>& data)
184{
185 uint8_t buffer[1024];
186 FILE* f = fsbridge::fopen(p, "rb");
187 if (f == nullptr) return false;
188 do {
189 const size_t length = fread(buffer, sizeof(uint8_t), sizeof(buffer), f);
190 if (ferror(f)) return false;
191 data.insert(data.end(), buffer, buffer + length);
192 } while (!feof(f));
193 fclose(f);
194 return true;
195}
196#endif
197
198#if defined(PROVIDE_FUZZ_MAIN_FUNCTION) && !defined(__AFL_LOOP)

Callers 1

mainFunction · 0.85

Calls 3

fopenFunction · 0.85
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected