pgvector.git / summary / log / commit / refs
commit 4de2932a27cce9eca30f54cc1db42b0d71f70dbf
Author: Andrew Kane <andrew@ankane.org>
Date: Thu Aug 13 20:08:41 2026 +0000
Improved error messages for safety checks [skip ci]
src/ivfflat.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/ivfflat.h b/src/ivfflat.h
index 9d58b398..66830b9b 100644
--- a/src/ivfflat.h
+++ b/src/ivfflat.h
@@ -322,8 +322,9 @@ typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
static inline Pointer
VectorArrayGet(VectorArray arr, int offset)
{
+ /* Safety check */
if (offset < 0 || offset >= arr->maxlen)
- elog(ERROR, "safety check failed");
+ elog(ERROR, "index out of bounds");
return ((char *) arr->items) + (offset * arr->itemsize);
}
@@ -333,8 +334,9 @@ VectorArraySet(VectorArray arr, int offset, Pointer val)
{
Size size = VARSIZE_ANY(val);
+ /* Safety check */
if (size > arr->itemsize)
- elog(ERROR, "safety check failed");
+ elog(ERROR, "item too large");
memcpy(VectorArrayGet(arr, offset), val, size);
}
[parent: 521957586f95]