diff options
author | merge-script <fanquake@gmail.com> | 2024-07-01 11:58:58 +0100 |
---|---|---|
committer | merge-script <fanquake@gmail.com> | 2024-07-01 11:58:58 +0100 |
commit | c3b446a494dced2e256b7516de6626d22da41f79 (patch) | |
tree | db556ad57d408a5d9dac2146a828a8d0d63c10a5 /src/init/bitcoind.cpp | |
parent | 2f813154ef9efed79d60661bedfb69c162375da0 (diff) | |
parent | 4d81b4de339efbbb68c9785203b699e6e12ecd83 (diff) |
Merge bitcoin/bitcoin#30273: fuzz: FuzzedSock::Recv() don't lose bytes from MSG_PEEK read
4d81b4de339efbbb68c9785203b699e6e12ecd83 fuzz: FuzzedSock::Recv() don't lose bytes from MSG_PEEK read (Vasil Dimov)
b51d75ea97ee0d01ee586e40a30cb68c0bf7ffd3 fuzz: simplify FuzzedSock::m_peek_data (Vasil Dimov)
Pull request description:
Problem:
If `FuzzedSock::Recv(N, MSG_PEEK)` is called then `N` bytes would be
retrieved from the fuzz provider, saved in `m_peek_data` and returned
to the caller (ok).
If after this `FuzzedSock::Recv(M, 0)` is called where `M < N`
then the first `M` bytes from `m_peek_data` would be returned
to the caller (ok), but the remaining `N - M` bytes in `m_peek_data`
would be discarded/lost (not ok). They must be returned by a subsequent
`Recv()`.
To resolve this, only remove the head `N` bytes from `m_peek_data`.
---
This is a followup to https://github.com/bitcoin/bitcoin/pull/30211, more specifically:
https://github.com/bitcoin/bitcoin/pull/30211#discussion_r1633199919
https://github.com/bitcoin/bitcoin/pull/30211#discussion_r1633216366
ACKs for top commit:
marcofleon:
ACK 4d81b4de339efbbb68c9785203b699e6e12ecd83. Tested this with the I2P fuzz target and there's no loss in coverage. I think overall this is an improvement in the robustness of `Recv` in `FuzzedSock`.
dergoegge:
Code review ACK 4d81b4de339efbbb68c9785203b699e6e12ecd83
brunoerg:
utACK 4d81b4de339efbbb68c9785203b699e6e12ecd83
Tree-SHA512: 73b5cb396784652447874998850e45899e8cba49dcd2cc96b2d1f63be78e48201ab88a76cf1c3cb880abac57af07f2c65d673a1021ee1a577d0496c3a4b0c5dd
Diffstat (limited to 'src/init/bitcoind.cpp')
0 files changed, 0 insertions, 0 deletions