mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
fuzz work
This commit is contained in:
parent
ac01e330de
commit
65656cbadc
13 changed files with 261 additions and 0 deletions
30
tests/fuzz/exec.c
Normal file
30
tests/fuzz/exec.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sqlite-vec.h"
|
||||
#include "sqlite3.h"
|
||||
#include <assert.h>
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
int rc = SQLITE_OK;
|
||||
sqlite3 *db;
|
||||
sqlite3_stmt *stmt;
|
||||
if(size < 1) return 0;
|
||||
|
||||
rc = sqlite3_open(":memory:", &db);
|
||||
assert(rc == SQLITE_OK);
|
||||
rc = sqlite3_vec_init(db, NULL, NULL);
|
||||
assert(rc == SQLITE_OK);
|
||||
|
||||
const char * zSrc = sqlite3_mprintf("%.*s", size, data);
|
||||
assert(zSrc);
|
||||
|
||||
sqlite3_exec(db, zSrc, NULL, NULL, NULL);
|
||||
sqlite3_free(zSrc);
|
||||
|
||||
sqlite3_close(db);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue