MCPcopy Create free account
hub / github.com/ElementsProject/elements / open

Method open

src/test/fuzz/util.cpp:510–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510FILE* FuzzedFileProvider::open()
511{
512 SetFuzzedErrNo(m_fuzzed_data_provider);
513 if (m_fuzzed_data_provider.ConsumeBool()) {
514 return nullptr;
515 }
516 std::string mode;
517 CallOneOf(
518 m_fuzzed_data_provider,
519 [&] {
520 mode = "r";
521 },
522 [&] {
523 mode = "r+";
524 },
525 [&] {
526 mode = "w";
527 },
528 [&] {
529 mode = "w+";
530 },
531 [&] {
532 mode = "a";
533 },
534 [&] {
535 mode = "a+";
536 });
537#if defined _GNU_SOURCE && !defined __ANDROID__
538 const cookie_io_functions_t io_hooks = {
539 FuzzedFileProvider::read,
540 FuzzedFileProvider::write,
541 FuzzedFileProvider::seek,
542 FuzzedFileProvider::close,
543 };
544 return fopencookie(this, mode.c_str(), io_hooks);
545#else
546 (void)mode;
547 return nullptr;
548#endif
549}
550
551ssize_t FuzzedFileProvider::read(void* cookie, char* buf, size_t size)
552{

Callers 15

run_testMethod · 0.45
OpenMethod · 0.45
BerkeleyEnvironmentMethod · 0.45
RewriteMethod · 0.45
RecoverDatabaseFileFunction · 0.45
DumpWalletFunction · 0.45
importwalletFunction · 0.45
dumpwalletFunction · 0.45
WriteTextFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45

Calls 3

SetFuzzedErrNoFunction · 0.85
CallOneOfFunction · 0.85
ConsumeBoolMethod · 0.80

Tested by

no test coverage detected