diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-11-03 09:14:10 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-11-03 09:14:22 +0100 |
commit | 5174b534da57066dca2e82a617c62919b6d638fd (patch) | |
tree | dc0c12ef07a87472988317749b04297b0de06970 /src | |
parent | 8387f832d6932d72adb86eaa4aecfd0c35341acc (diff) | |
parent | c2cf8a18c25bf19ade51fedfa5c352bd7145edb0 (diff) |
Merge #20289: fuzz: Check for addrv1 compatibility before using addrv1 serializer/deserializer on CService
c2cf8a18c25bf19ade51fedfa5c352bd7145edb0 fuzz: Check for addrv1 compatibility before using addrv1 serializer on CService (practicalswift)
Pull request description:
Check for addrv1 compatibility before using addrv1 serializer/deserializer on `CService`:
Before this patch:
```
$ src/test/fuzz/service_deserialize
service_deserialize: test/fuzz/deserialize.cpp:85:
void (anonymous namespace)::AssertEqualAfterSerializeDeserialize(const T &, const int) [T = CService]:
Assertion `Deserialize<T>(Serialize(obj, version)) == obj' failed.
```
After this patch:
```
$ src/test/fuzz/service_deserialize
…
```
Related change: #20247
ACKs for top commit:
MarcoFalke:
review ACK c2cf8a18c25bf19ade51fedfa5c352bd7145edb0
Tree-SHA512: dba6ddc60e8ef621011d844281461f1741de08c4af1a2b7156c810af44306cef7ec582de5974752db02ca085cfd23da0296d70b694e59ee262589d829fa0626e
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/deserialize.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp index 26c56fbadf..9803fdc882 100644 --- a/src/test/fuzz/deserialize.cpp +++ b/src/test/fuzz/deserialize.cpp @@ -191,7 +191,10 @@ void test_one_input(const std::vector<uint8_t>& buffer) #elif SERVICE_DESERIALIZE CService s; DeserializeFromFuzzingInput(buffer, s); - AssertEqualAfterSerializeDeserialize(s); + if (s.IsAddrV1Compatible()) { + AssertEqualAfterSerializeDeserialize(s); + } + AssertEqualAfterSerializeDeserialize(s, INIT_PROTO_VERSION | ADDRV2_FORMAT); #elif MESSAGEHEADER_DESERIALIZE CMessageHeader mh; DeserializeFromFuzzingInput(buffer, mh); |