Repository navigation
Expand file tree
/
Copy pathscript.h
More file actions
52 lines (37 loc) · 1.61 KB
/
Copy pathscript.h
File metadata and controls
52 lines (37 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef FUZZ_SCRIPT_H
#define FUZZ_SCRIPT_H
#include <stddef.h>
#include <stdint.h>
#include "api.h"
struct input {
const uint8_t *data;
size_t size;
};
/* Everything a read-back observed, result codes included, so two builds can be compared byte for byte. */
struct dump {
unsigned char *bytes;
size_t len;
size_t cap;
};
enum script_mode {
SCRIPT_STRUCTURED,
/* Adds statements taken verbatim from the input, which only the single-build target can afford. */
SCRIPT_WITH_RAW_SQL,
};
#define SCRIPT_FILES 3
/* Puts the library's process-wide settings back to the same state before every input. */
void script_reset(const struct fuzz_sqlite *api);
/* Makes later runs and dumps parse inputs as api would, or as their own library when api is NULL. */
void script_parse_like(const struct fuzz_sqlite *api);
/* Runs the operations the input encodes and closes every connection it opened. */
void script_run(const struct fuzz_sqlite *api, struct input *in, enum script_mode mode);
/* Opens a file with the key and settings the last run left recorded for it, and reads all of it back. */
void script_dump(const struct fuzz_sqlite *api, int file, struct dump *out);
/* Like script_dump, but only table rows and integrity_check, which plain SQLite can reproduce. */
void script_dump_content(const struct fuzz_sqlite *api, int file, struct dump *out);
/* Whether the last run, or the script_dump_content after it, did something to file plain SQLite cannot reproduce. */
int script_plain_exempt(int file);
/* Whether raw damage in the last run hit file. */
int script_damaged(int file);
void dump_free(struct dump *out);
#endif