diff options
| -rw-r--r-- | sqlite.zig | 19 |
1 files changed, 19 insertions, 0 deletions
| @@ -3198,3 +3198,22 @@ test "sqlite: empty slice" { | |||
| 3198 | try testing.expectEqualSlices(u8, "", row.?.data.data); | 3198 | try testing.expectEqualSlices(u8, "", row.?.data.data); |
| 3199 | } | 3199 | } |
| 3200 | } | 3200 | } |
| 3201 | |||
| 3202 | test "sqlite: fuzzer found crashes" { | ||
| 3203 | const test_cases = &[_]struct { | ||
| 3204 | input: []const u8, | ||
| 3205 | exp_error: anyerror, | ||
| 3206 | }{ | ||
| 3207 | .{ | ||
| 3208 | .input = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00CREATE TABLE \x80\x00\x00\x00ar(Wb)\x01", | ||
| 3209 | .exp_error = error.SQLiteError, | ||
| 3210 | }, | ||
| 3211 | }; | ||
| 3212 | |||
| 3213 | inline for (test_cases) |tc| { | ||
| 3214 | var db = try getTestDb(); | ||
| 3215 | defer db.deinit(); | ||
| 3216 | |||
| 3217 | try testing.expectError(tc.exp_error, db.exec(tc.input, .{}, .{})); | ||
| 3218 | } | ||
| 3219 | } | ||