-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathSQLite3Fuzzer.java
More file actions
32 lines (25 loc) · 960 Bytes
/
SQLite3Fuzzer.java
File metadata and controls
32 lines (25 loc) · 960 Bytes
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
package sqlancer.sqlite3.oracle;
import sqlancer.Randomly;
import sqlancer.common.oracle.TestOracle;
import sqlancer.common.query.SQLQueryAdapter;
import sqlancer.sqlite3.SQLite3GlobalState;
import sqlancer.sqlite3.SQLite3Visitor;
// tries to trigger a crash
public class SQLite3Fuzzer implements TestOracle {
private final SQLite3GlobalState globalState;
public SQLite3Fuzzer(SQLite3GlobalState globalState) {
this.globalState = globalState;
}
@Override
public void check() throws Exception {
String s = SQLite3Visitor
.asString(SQLite3RandomQuerySynthesizer.generate(globalState, Randomly.smallNumber() + 1)) + ";";
try {
if (globalState.getDbmsSpecificOptions().executeQuery) {
globalState.executeStatement(new SQLQueryAdapter(s));
globalState.getManager().incrementSelectQueryCount();
}
} catch (Error e) {
}
}
}