fix segfault on invalid vec_each() input, fixes #163

This commit is contained in:
Alex Garcia 2025-01-10 14:44:37 -08:00
parent 21eda5c24d
commit 44e4438ed5
2 changed files with 6 additions and 1 deletions

View file

@ -2483,7 +2483,9 @@ static int vec_eachOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor) {
static int vec_eachClose(sqlite3_vtab_cursor *cur) { static int vec_eachClose(sqlite3_vtab_cursor *cur) {
vec_each_cursor *pCur = (vec_each_cursor *)cur; vec_each_cursor *pCur = (vec_each_cursor *)cur;
if(pCur->vector) {
pCur->cleanup(pCur->vector); pCur->cleanup(pCur->vector);
}
sqlite3_free(pCur); sqlite3_free(pCur);
return SQLITE_OK; return SQLITE_OK;
} }

View file

@ -1614,6 +1614,9 @@ def test_vec_each():
{"rowid": 2, "value": 3.0}, {"rowid": 2, "value": 3.0},
] ]
with _raises("Input must have type BLOB (compact format) or TEXT (JSON), found NULL"):
vec_each_f32(None)
import io import io