|
|
@ -24,9 +24,8 @@ struct instructions_t |
|
|
|
static hb_set_t *create_set (const uint32_t *value_array, int count) |
|
|
|
static hb_set_t *create_set (const uint32_t *value_array, int count) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hb_set_t *set = hb_set_create (); |
|
|
|
hb_set_t *set = hb_set_create (); |
|
|
|
for (int i = 0; i < count; i++) { |
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
hb_set_add (set, value_array[i]); |
|
|
|
hb_set_add (set, value_array[i]); |
|
|
|
} |
|
|
|
|
|
|
|
return set; |
|
|
|
return set; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -36,23 +35,23 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) |
|
|
|
if (size < sizeof (instructions_t)) |
|
|
|
if (size < sizeof (instructions_t)) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
const instructions_t* instructions = reinterpret_cast<const instructions_t*> (data); |
|
|
|
const instructions_t &instructions = reinterpret_cast<const instructions_t &> (data); |
|
|
|
data += sizeof (instructions_t); |
|
|
|
data += sizeof (instructions_t); |
|
|
|
size -= sizeof (instructions_t); |
|
|
|
size -= sizeof (instructions_t); |
|
|
|
|
|
|
|
|
|
|
|
const uint32_t *values = reinterpret_cast<const uint32_t *> (data); |
|
|
|
const uint32_t *values = reinterpret_cast<const uint32_t *> (data); |
|
|
|
size = size / sizeof (uint32_t); |
|
|
|
size = size / sizeof (uint32_t); |
|
|
|
|
|
|
|
|
|
|
|
if (size < instructions->first_set_size) |
|
|
|
if (size < instructions.first_set_size) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
hb_set_t* set_a = create_set (values, instructions->first_set_size); |
|
|
|
hb_set_t *set_a = create_set (values, instructions.first_set_size); |
|
|
|
|
|
|
|
|
|
|
|
values += instructions->first_set_size; |
|
|
|
values += instructions.first_set_size; |
|
|
|
size -= instructions->first_set_size; |
|
|
|
size -= instructions.first_set_size; |
|
|
|
hb_set_t *set_b = create_set (values, size); |
|
|
|
hb_set_t *set_b = create_set (values, size); |
|
|
|
|
|
|
|
|
|
|
|
switch (instructions->operation) |
|
|
|
switch (instructions.operation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case INTERSECT: |
|
|
|
case INTERSECT: |
|
|
|
hb_set_intersect (set_a, set_b); |
|
|
|
hb_set_intersect (set_a, set_b); |
|
|
|