Some checks failed
Coverage (Nightly) / Build with Coverage (push) Has been cancelled
Coverage (Nightly) / Test (postgres) (push) Has been cancelled
Coverage (Nightly) / Test (sqlite) (push) Has been cancelled
Coverage (Nightly) / Generate Coverage Report (push) Has been cancelled
Repro Build Nightly / Ubuntu repro build: focal (push) Has been cancelled
Repro Build Nightly / Ubuntu repro build: jammy (push) Has been cancelled
Repro Build Nightly / Ubuntu repro build: noble (push) Has been cancelled
Python API Docs (Nightly) / Generate Python API Documentation (push) Has been cancelled
Documentation (Nightly) / Generate Project Documentation (push) Has been cancelled
Publish Documentation Site / Generate Coverage Reports (push) Has been cancelled
Publish Documentation Site / Generate Python API Documentation (push) Has been cancelled
Publish Documentation Site / Generate Project Documentation (push) Has been cancelled
Publish Documentation Site / Deploy to GitHub Pages (push) Has been cancelled
43 lines
988 B
C
43 lines
988 B
C
#include "config.h"
|
|
#include <assert.h>
|
|
#include <bitcoin/chainparams.h>
|
|
#include <ccan/ccan/tal/str/str.h>
|
|
#include <common/setup.h>
|
|
#include <common/utils.h>
|
|
#include <common/wireaddr.h>
|
|
#include <tests/fuzz/libfuzz.h>
|
|
|
|
#define DEFAULT_PORT 9735
|
|
|
|
void init(int *argc, char ***argv)
|
|
{
|
|
/* Don't call this if we're in unit-test mode, as libfuzz.c does it */
|
|
if (!tmpctx)
|
|
common_setup("fuzzer");
|
|
chainparams = chainparams_for_network("palladium");
|
|
}
|
|
|
|
void run(const uint8_t *data, size_t size)
|
|
{
|
|
char *addr = to_string(tmpctx, data, size);
|
|
|
|
struct wireaddr wa, decoded_wa;
|
|
const char *err;
|
|
|
|
err = parse_wireaddr(tmpctx, addr, DEFAULT_PORT, NULL, &wa);
|
|
|
|
if (!err) {
|
|
assert(fmt_wireaddr(tmpctx, &wa));
|
|
|
|
u8 *output_buffer = tal_arr(tmpctx, u8, 0);
|
|
towire_wireaddr(&output_buffer, &wa);
|
|
size_t len = tal_bytelen(output_buffer);
|
|
|
|
assert(fromwire_wireaddr((const u8 **)&output_buffer, &len,
|
|
&decoded_wa));
|
|
assert(wireaddr_eq(&wa, &decoded_wa));
|
|
}
|
|
|
|
clean_tmpctx();
|
|
}
|