mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-02 18:50:56 +08:00
Hardened VectorArraySet [skip ci]
This commit is contained in:
@@ -309,7 +309,12 @@ VectorArrayGet(VectorArray arr, int offset)
|
||||
static inline void
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user