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

Method open

src/test/fuzz/util.cpp:251–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251FILE* FuzzedFileProvider::open()
252{
253 SetFuzzedErrNo(m_fuzzed_data_provider);
254 if (m_fuzzed_data_provider.ConsumeBool()) {
255 return nullptr;
256 }
257 std::string mode;
258 CallOneOf(
259 m_fuzzed_data_provider,
260 [&] {
261 mode = "r";
262 },
263 [&] {
264 mode = "r+";
265 },
266 [&] {
267 mode = "w";
268 },
269 [&] {
270 mode = "w+";
271 },
272 [&] {
273 mode = "a";
274 },
275 [&] {
276 mode = "a+";
277 });
278#if defined _GNU_SOURCE && (defined(__linux__) || defined(__FreeBSD__))
279 const cookie_io_functions_t io_hooks = {
280 FuzzedFileProvider::read,
281 FuzzedFileProvider::write,
282 FuzzedFileProvider::seek,
283 FuzzedFileProvider::close,
284 };
285 return fopencookie(this, mode.c_str(), io_hooks);
286#else
287 (void)mode;
288 return nullptr;
289#endif
290}
291
292ssize_t FuzzedFileProvider::read(void* cookie, char* buf, size_t size)
293{

Callers 15

runFunction · 0.45
remove_wallet_settingMethod · 0.45
test_wallet_settingsMethod · 0.45
run_testMethod · 0.45
DumpWalletFunction · 0.45
WriteTextFunction · 0.45

Calls 3

SetFuzzedErrNoFunction · 0.85
CallOneOfFunction · 0.85
ConsumeBoolMethod · 0.80

Tested by

no test coverage detected