Logo
Explore Help
Sign In
davide/palladum-lightning
1
0
Fork 0
You've already forked palladum-lightning
Code Issues Pull Requests Actions 5 Packages Projects Releases Wiki Activity
Files
e619bf00fbf5df8752da76e460c798e758402fef
palladum-lightning/tests/fuzz/fuzz-addr.c

23 lines
481 B
C
Raw Normal View History

build: introduce a fuzzing mode This adds a new configuration, --enable-fuzzing (which is more than welcome to be coupled with --enable-address-sanitizer), to pass the fuzzer sanitizer argument when compiling objects. This allows libfuzzer to actually be able "to fuzz" by detecting coverage and be smart when mutating inputs. As libfuzzer brings its own ~~fees~~ main(), we compile objects with fsanitize=fuzzer-no-link, and special-case the linkage of the fuzz targets. A "lib" is added to abstract out the interface to the fuzzing tool used. This allow us to use the same targets to fuzz using AFL, hongfuzz or w/e by adding their entrypoints into libfuzz. (h/t to practicalswift who introduced this for bitcoin-core, which i mimiced) Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-07 17:32:19 +02:00
#include "common/utils.h"
#include <stdint.h>
#include <tests/fuzz/libfuzz.h>
#include <ccan/ccan/tal/tal.h>
#include <common/addr.h>
#include <common/setup.h>
void init(int *argc, char ***argv)
{
chainparams = chainparams_for_network("bitcoin");
common_setup("fuzzer");
}
void run(const uint8_t *data, size_t size)
{
uint8_t *script_pubkey = tal_dup_arr(tmpctx, uint8_t, data, size, 0);
encode_scriptpubkey_to_addr(tmpctx, chainparams, script_pubkey);
clean_tmpctx();
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.3 Page: 149ms Template: 11ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API