add fuzz_alpm_extract_keyid
This commit is contained in:
parent
275fb8997f
commit
b89287281d
3 changed files with 40 additions and 1 deletions
11
meson.build
11
meson.build
|
@ -423,7 +423,16 @@ executable(
|
||||||
c_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer', '-DFUZZING_PACMAN'],
|
c_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer', '-DFUZZING_PACMAN'],
|
||||||
link_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer'],
|
link_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer'],
|
||||||
)
|
)
|
||||||
|
# Note: this target must be built with clang!
|
||||||
|
executable(
|
||||||
|
'fuzz_alpm_extract_keyid',
|
||||||
|
[fuzz_alpm_extract_keyid_sources, pacman_sources],
|
||||||
|
include_directories : includes,
|
||||||
|
link_with : [libalpm_a, libcommon],
|
||||||
|
dependencies : [],
|
||||||
|
c_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer', '-DFUZZING_PACMAN'],
|
||||||
|
link_args : ['-fsanitize=fuzzer,address', '-ggdb', '-O0', '-fno-omit-frame-pointer'],
|
||||||
|
)
|
||||||
|
|
||||||
foreach wrapper : script_wrappers
|
foreach wrapper : script_wrappers
|
||||||
cdata = configuration_data()
|
cdata = configuration_data()
|
||||||
|
|
26
src/fuzzing/fuzz_alpm_extract_keyid.c
Normal file
26
src/fuzzing/fuzz_alpm_extract_keyid.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#define _XOPEN_SOURCE
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
/* libalpm */
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "alpm_list.h"
|
||||||
|
#include "handle.h"
|
||||||
|
|
||||||
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
|
||||||
|
|
||||||
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||||
|
if (Size == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
alpm_handle_t handle; // TODO/FIXME?
|
||||||
|
const char* filename = "/dev/null"; // TODO/FIXME?
|
||||||
|
|
||||||
|
alpm_list_t *keys = NULL;
|
||||||
|
alpm_extract_keyid(&handle, filename, /* sig */ Data, /* len */ Size, &keys);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -5,3 +5,7 @@ fuzz_wordsplit_sources = files('''
|
||||||
fuzz_string_length_sources = files('''
|
fuzz_string_length_sources = files('''
|
||||||
fuzz_string_length.c
|
fuzz_string_length.c
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
|
fuzz_alpm_extract_keyid_sources = files('''
|
||||||
|
fuzz_alpm_extract_keyid.c
|
||||||
|
'''.split())
|
||||||
|
|
Loading…
Add table
Reference in a new issue