/* libFuzzer target for the qualification operation-sequence boundary.
* Bounded: cap_len is passed by the harness (max_len), and the parser itself
* accepts at most Q_MAX_OPS operations. The oracle must never reject a
* sequence the fixture produced from well-formed input. */
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "qual.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
q_op ops[Q_MAX_OPS];
size_t n = q_parse_ops(data, size, ops, Q_MAX_OPS);
q_ctx *c;
q_trace t;
const q_record *r;
const q_effect *e;
size_t nr, ne;
if (n == 0 || n == SIZE_MAX) {
return 0;
}
c = q_new(1);
if (c == NULL) {
abort();
}
q_run_ops(c, ops, n, &t);
r = q_records(c, &nr);
e = q_effects(c, &ne);
{
char d[128];
if (q_oracle_check(ops, n, &t, r, nr, e, ne, d, sizeof d) != Q_OK) {
abort();
}
}
q_free(c);
return 0;
}