mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-14 16:46:54 +08:00
Hardened VectorArraySet [skip ci]
This commit is contained in:
@@ -309,7 +309,12 @@ VectorArrayGet(VectorArray arr, int offset)
|
|||||||
static inline void
|
static inline void
|
||||||
VectorArraySet(VectorArray arr, int offset, Pointer val)
|
VectorArraySet(VectorArray arr, int offset, Pointer val)
|
||||||
{
|
{
|
||||||
memcpy(VectorArrayGet(arr, offset), val, VARSIZE_ANY(val));
|
Size size = VARSIZE_ANY(val);
|
||||||
|
|
||||||
|
if (size > arr->itemsize)
|
||||||
|
elog(ERROR, "safety check failed");
|
||||||
|
|
||||||
|
memcpy(VectorArrayGet(arr, offset), val, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|||||||
Reference in New Issue
Block a user