diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index 1cef8eebd..922c1ee54 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -11,6 +11,7 @@ FUZZ_COMMON_OBJS := \ common/amount.o \ common/addr.o \ common/base32.o \ + common/base64.o \ common/bech32.o \ common/bigsize.o \ common/json.o \ diff --git a/tests/fuzz/fuzz-base32-64.c b/tests/fuzz/fuzz-base32-64.c new file mode 100644 index 000000000..fe19a781d --- /dev/null +++ b/tests/fuzz/fuzz-base32-64.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +#include +#include + +void init(int *argc, char ***argv) +{ +} + +void run(const uint8_t *data, size_t size) +{ + char *encoded; + uint8_t *decoded; + + encoded = b32_encode(NULL, data, size); + decoded = b32_decode(NULL, encoded, strlen(encoded)); + assert(memcmp(decoded, data, size) == 0); + tal_free(encoded); + tal_free(decoded); + + encoded = b64_encode(NULL, data, size); + tal_free(encoded); +}