darosior
commented at 8:06 pm on January 16, 2025:
member
Based on #31022, this introduces a fuzz target for PCPRequestPortMap and NATPMPRequestPortMap.
Like in #31022 we set CreateSock to return a Sock which mocks the responses from the server and uses a mocked steady clock for the Waits. Except here we simply respond with fuzzer-provided data until the client stop sending requests. We also sometimes inject errors and connection failures based on fuzzer-provided data.
I ran both targets overnight and generated a combined coverage report, temporarily available here.
DrahtBot
commented at 8:06 pm on January 16, 2025:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
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.
DrahtBot added the label
Tests
on Jan 16, 2025
DrahtBot added the label
CI failed
on Jan 16, 2025
DrahtBot
commented at 11:51 pm on January 16, 2025:
contributor
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
laanwj requested review from laanwj
on Jan 17, 2025
fanquake
commented at 11:24 am on January 17, 2025:
member
0 package_eval.cpp
1D:\a\bitcoin\bitcoin\src\test\fuzz\pcp.cpp(121,47): error C2220: the following warning is treated as an error [D:\a\bitcoin\bitcoin\build\src\test\fuzz\fuzz.vcxproj]2D:\a\bitcoin\bitcoin\src\test\fuzz\pcp.cpp(121,47): warning C4305: 'return': truncation from 'int' to 'bool'[D:\a\bitcoin\bitcoin\build\src\test\fuzz\fuzz.vcxproj]3 parse_hd_keypath.cpp
4 parse_iso8601.cpp
net: Add optional length checking to CService::SetSockAddr
In almost all cases (the only exception is `getifaddrs`), we know the
size of the data passed into SetSockAddr, so we can check this to be
what is expected.
397e99f2cd
util: Add mockable steady_clock
This adds a NodeSteadyClock, which is a steady_clock that can be mocked
with millisecond precision.
9693c641bb
net: Use mockable steady clock in PCP implementation
This will be needed for the test harness.
6a7a567d6d
test: Add tests for PCP and NATPMP implementations
Add a mock for a simple scriptable UDP server, and use this to test
various code paths (including successful mappings, timeouts and errors)
in the PCP and NATPMP implementations.
7a9e169102
qa: cover PROTOCOL_ERROR variant in PCP unit tests941138da90
pcp: make the ToString method const4e9a4cc23a
darosior force-pushed
on Jan 17, 2025
pcp: make NAT-PMP error codes uint16_t
They are defined as being 16 bits in the RFC and correctly parsed in the code
which may result in an implicit conversion from uint16_t to uint8_t.
19423e86fd
fuzz: implement targets for PCP and NAT-PMP port mapping requests
This adapts some code written by Wladimir J. Van Der Laan for unit testing
those same functions.
33a4dc294a
darosior force-pushed
on Jan 17, 2025
darosior
commented at 9:56 pm on January 17, 2025:
member
Pushed a new commit to avoid the implicit u16 -> u8 conversion, which for some reason i can’t reproduce (and didn’t hit) locally.
DrahtBot removed the label
CI failed
on Jan 18, 2025
dergoegge
commented at 11:51 am on January 19, 2025:
member
Have tried to investigate what is happening in @dergoegge ’s case but was unable to find the issue, how PCPSendRecv can return a response while the buffer is uninitialized. Would be interesting if this already found its first bug.
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: 2025-01-21 03:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me