Skip to content

Commit 4ce1ef3

Browse files
asg017claude
andcommitted
Fix bad-free in ensure_vector_match: aCleanup(a) → aCleanup(*a)
When the second vector argument fails to parse, the cleanup of the first vector was called with the double-pointer 'a' instead of '*a'. When the first vector was parsed from JSON text (cleanup = sqlite3_free), this called sqlite3_free on a stack address, causing a crash. Found by the vec-mismatch fuzz target. Shout out to @renatgalimov in #257 for finding the original bug! Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0dd0765 commit 4ce1ef3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sqlite-vec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ int ensure_vector_match(sqlite3_value *aValue, sqlite3_value *bValue, void **a,
10281028
if (rc != SQLITE_OK) {
10291029
*outError = sqlite3_mprintf("Error reading 2nd vector: %s", error);
10301030
sqlite3_free(error);
1031-
aCleanup(a);
1031+
aCleanup(*a);
10321032
return SQLITE_ERROR;
10331033
}
10341034

0 commit comments

Comments
 (0)