test: Fix off-by-one in mockscheduler test RPC #21948

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2105-testMock1 changing 2 files +3 −2
  1. MarcoFalke commented at 10:45 AM on May 14, 2021: member

    Fixes:

    fuzz: scheduler.cpp:83: void CScheduler::MockForward(std::chrono::seconds): Assertion `delta_seconds.count() > 0 && delta_seconds < std::chrono::hours{1}' failed.
    ==1059066== ERROR: libFuzzer: deadly signal
        [#0](/bitcoin-bitcoin/0/) 0x558f75449c10 in __sanitizer_print_stack_trace (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5fec10)
        [#1](/bitcoin-bitcoin/1/) 0x558f753f32b8 in fuzzer::PrintStackTrace() fuzzer.o
        [#2](/bitcoin-bitcoin/2/) 0x558f753d68d3 in fuzzer::Fuzzer::CrashCallback() fuzzer.o
        [#3](/bitcoin-bitcoin/3/) 0x7f4a3cbbb3bf  (/lib/x86_64-linux-gnu/libpthread.so.0+0x153bf)
        [#4](/bitcoin-bitcoin/4/) 0x7f4a3c7ff18a in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618a)
        [#5](/bitcoin-bitcoin/5/) 0x7f4a3c7de858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x25858)
        [#6](/bitcoin-bitcoin/6/) 0x7f4a3c7de728  (/lib/x86_64-linux-gnu/libc.so.6+0x25728)
        [#7](/bitcoin-bitcoin/7/) 0x7f4a3c7eff35 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x36f35)
        [#8](/bitcoin-bitcoin/8/) 0x558f7588a913 in CScheduler::MockForward(std::chrono::duration<long, std::ratio<1l, 1l> >) scheduler.cpp:83:5
        [#9](/bitcoin-bitcoin/9/) 0x558f75b0e5b1 in mockscheduler()::$_7::operator()(RPCHelpMan const&, JSONRPCRequest const&) const rpc/misc.cpp:435:30
        [#10](/bitcoin-bitcoin/10/) 0x558f75b0e5b1 in std::_Function_handler<UniValue (RPCHelpMan const&, JSONRPCRequest const&), mockscheduler()::$_7>::_M_invoke(std::_Any_data const&, RPCHelpMan const&, JSONRPCRequest const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
        [#11](/bitcoin-bitcoin/11/) 0x558f7587a141 in std::function<UniValue (RPCHelpMan const&, JSONRPCRequest const&)>::operator()(RPCHelpMan const&, JSONRPCRequest const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
        [#12](/bitcoin-bitcoin/12/) 0x558f7587a141 in RPCHelpMan::HandleRequest(JSONRPCRequest const&) const rpc/util.cpp:565:26
        [#13](/bitcoin-bitcoin/13/) 0x558f756c0086 in CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)::operator()(JSONRPCRequest const&, UniValue&, bool) const ./rpc/server.h:110:91
        [#14](/bitcoin-bitcoin/14/) 0x558f756c0086 in std::_Function_handler<bool (JSONRPCRequest const&, UniValue&, bool), CRPCCommand::CRPCCommand(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RPCHelpMan (*)())::'lambda'(JSONRPCRequest const&, UniValue&, bool)>::_M_invoke(std::_Any_data const&, JSONRPCRequest const&, UniValue&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
        [#15](/bitcoin-bitcoin/15/) 0x558f756b8592 in std::function<bool (JSONRPCRequest const&, UniValue&, bool)>::operator()(JSONRPCRequest const&, UniValue&, bool) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
        [#16](/bitcoin-bitcoin/16/) 0x558f756b8592 in ExecuteCommand(CRPCCommand const&, JSONRPCRequest const&, UniValue&, bool) rpc/server.cpp:480:20
        [#17](/bitcoin-bitcoin/17/) 0x558f756b8592 in ExecuteCommands(std::vector<CRPCCommand const*, std::allocator<CRPCCommand const*> > const&, JSONRPCRequest const&, UniValue&) rpc/server.cpp:444:13
        [#18](/bitcoin-bitcoin/18/) 0x558f756b8017 in CRPCTable::execute(JSONRPCRequest const&) const rpc/server.cpp:464:13
        [#19](/bitcoin-bitcoin/19/) 0x558f7552457a in (anonymous namespace)::RPCFuzzTestingSetup::CallRPC(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) test/fuzz/rpc.cpp:50:25
        [#20](/bitcoin-bitcoin/20/) 0x558f7552457a in rpc_fuzz_target(Span<unsigned char const>) test/fuzz/rpc.cpp:354:28
        [#21](/bitcoin-bitcoin/21/) 0x558f7544cf0f in std::_Function_handler<void (Span<unsigned char const>), void (*)(Span<unsigned char const>)>::_M_invoke(std::_Any_data const&, Span<unsigned char const>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:300:2
        [#22](/bitcoin-bitcoin/22/) 0x558f75c05197 in std::function<void (Span<unsigned char const>)>::operator()(Span<unsigned char const>) const /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
        [#23](/bitcoin-bitcoin/23/) 0x558f75c05197 in LLVMFuzzerTestOneInput test/fuzz/fuzz.cpp:74:5
        [#24](/bitcoin-bitcoin/24/) 0x558f753d8073 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) fuzzer.o
        [#25](/bitcoin-bitcoin/25/) 0x558f753c1f72 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) fuzzer.o
        [#26](/bitcoin-bitcoin/26/) 0x558f753c7d6a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) fuzzer.o
        [#27](/bitcoin-bitcoin/27/) 0x558f753f3a92 in main (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x5a8a92)
        [#28](/bitcoin-bitcoin/28/) 0x7f4a3c7e00b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
        [#29](/bitcoin-bitcoin/29/) 0x558f7539cc9d in _start (/root/fuzz_dir/scratch/fuzz_gen/code/src/test/fuzz/fuzz+0x551c9d)
    
  2. test: Fix off-by-one in mockscheduler test RPC fa2e614d16
  3. MarcoFalke force-pushed on May 14, 2021
  4. MarcoFalke commented at 10:55 AM on May 14, 2021: member

    Can also be tested by typing mockscheduler 3600

  5. DrahtBot added the label RPC/REST/ZMQ on May 14, 2021
  6. DrahtBot commented at 12:40 PM on May 14, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #21538 (fuzz: Add fuzzing syscall sandbox: detect use of unexpected syscalls when fuzzing ("syscall sanitizer") by practicalswift)
    • #20487 (Add syscall sandboxing using seccomp-bpf (Linux secure computing mode) by practicalswift)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. practicalswift commented at 7:50 AM on May 15, 2021: contributor

    Nice to see the RPC fuzzer find bugs :)

    cr ACK fa2e614d16af84327adf1c02746d0f73e0f48111

  8. MarcoFalke merged this on May 15, 2021
  9. MarcoFalke closed this on May 15, 2021

  10. MarcoFalke deleted the branch on May 15, 2021
  11. sidhujag referenced this in commit 177abd6677 on May 15, 2021
  12. gwillen referenced this in commit dda38f46bf on Jun 1, 2022
  13. DrahtBot locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me