mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-25 17:01:17 +01:00
Remove hb-set-fuzzer
This commit is contained in:
1 parent
a4ce5caeea
commit
e73a690d9e
2 files changed
+1
-103
No files matched your search
@@ -1,88 +0,0 @@
|
||||
#include "hb-fuzzer.hh"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "hb.h"
|
||||
|
||||
// Only allow ~5,000 set values between the two input sets.
|
||||
// Arbitrarily long input sets do not trigger any meaningful
|
||||
// differences in behaviour so there's no benefit from allowing
|
||||
// the fuzzer to create super large sets.
|
||||
#define MAX_INPUT_SIZE 20000
|
||||
|
||||
enum set_operation_t : uint8_t
|
||||
{
|
||||
INTERSECT = 0,
|
||||
UNION = 1,
|
||||
SUBTRACT = 2,
|
||||
SYMMETRIC_DIFFERENCE = 3
|
||||
};
|
||||
|
||||
struct instructions_t
|
||||
{
|
||||
set_operation_t operation;
|
||||
uint32_t first_set_size;
|
||||
};
|
||||
|
||||
static hb_set_t *create_set (const uint32_t *value_array, int count)
|
||||
{
|
||||
hb_set_t *set = hb_set_create ();
|
||||
for (int i = 0; i < count; i++)
|
||||
hb_set_add (set, value_array[i]);
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
|
||||
{
|
||||
_fuzzing_skip_leading_comment (&data, &size);
|
||||
alloc_state = _fuzzing_alloc_state (data, size);
|
||||
|
||||
if (size < sizeof (instructions_t))
|
||||
return 0;
|
||||
|
||||
if (size > MAX_INPUT_SIZE)
|
||||
return 0;
|
||||
|
||||
const instructions_t &instructions = reinterpret_cast<const instructions_t &> (*data);
|
||||
data += sizeof (instructions_t);
|
||||
size -= sizeof (instructions_t);
|
||||
|
||||
const uint32_t *values = reinterpret_cast<const uint32_t *> (data);
|
||||
size = size / sizeof (uint32_t);
|
||||
|
||||
if (size < instructions.first_set_size)
|
||||
return 0;
|
||||
|
||||
hb_set_t *set_a = create_set (values, instructions.first_set_size);
|
||||
|
||||
values += instructions.first_set_size;
|
||||
size -= instructions.first_set_size;
|
||||
hb_set_t *set_b = create_set (values, size);
|
||||
|
||||
switch (instructions.operation)
|
||||
{
|
||||
case INTERSECT:
|
||||
hb_set_intersect (set_a, set_b);
|
||||
break;
|
||||
case UNION:
|
||||
hb_set_union (set_a, set_b);
|
||||
break;
|
||||
case SUBTRACT:
|
||||
hb_set_subtract (set_a, set_b);
|
||||
break;
|
||||
case SYMMETRIC_DIFFERENCE:
|
||||
hb_set_symmetric_difference (set_a, set_b);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
hb_set_destroy (set_a);
|
||||
hb_set_destroy (set_b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
tests = [
|
||||
'hb-shape-fuzzer.cc',
|
||||
'hb-subset-fuzzer.cc',
|
||||
'hb-set-fuzzer.cc',
|
||||
'hb-raster-fuzzer.cc',
|
||||
'hb-vector-fuzzer.cc',
|
||||
'hb-repacker-fuzzer.cc',
|
||||
@@ -56,11 +55,10 @@ glob_cmd = find_program('glob.py', required: true)
|
||||
fonts_glob = run_command(glob_cmd, meson.current_source_dir() / 'fonts', check:true).stdout().strip().split('\n')
|
||||
subset_fonts_glob = run_command(glob_cmd, meson.current_source_dir() / '..' / 'subset' / 'data' / 'fonts', check:true).stdout().strip().split('\n')
|
||||
graphs_glob = run_command(glob_cmd, meson.current_source_dir() / 'graphs', check:true).stdout().strip().split('\n')
|
||||
sets_glob = run_command(glob_cmd, meson.current_source_dir() / 'sets', check:true).stdout().strip().split('\n')
|
||||
|
||||
# Chunk the glob lists to avoid command line length limits, and for parallelization
|
||||
chunk_size = 64
|
||||
foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'graphs_glob', 'sets_glob']
|
||||
foreach glob_name : ['fonts_glob', 'subset_fonts_glob', 'graphs_glob']
|
||||
glob = get_variable(glob_name)
|
||||
chunks = []
|
||||
chunk = []
|
||||
@@ -142,15 +140,3 @@ if not get_option('subset').disabled()
|
||||
i += 1
|
||||
endforeach
|
||||
endif
|
||||
|
||||
i = 0
|
||||
foreach chunk : sets_glob_chunks
|
||||
test('set-fuzzer-chunk-@0@'.format(i),
|
||||
hb_set_fuzzer_exe,
|
||||
args: chunk,
|
||||
workdir: meson.current_build_dir() / '..' / '..',
|
||||
protocol: 'tap',
|
||||
suite: ['fuzzing'],
|
||||
)
|
||||
i += 1
|
||||
endforeach
|
||||
Reference in new issue
Block a user