mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-13 08:06:54 +08:00
Improved check for VectorArrayInit [skip ci]
This commit is contained in:
@@ -25,8 +25,8 @@ VectorArrayInit(int maxlen, int dimensions, Size itemsize)
|
|||||||
{
|
{
|
||||||
VectorArray res;
|
VectorArray res;
|
||||||
|
|
||||||
if (maxlen < 1 || dimensions < 1)
|
if (maxlen < 1 || dimensions < 1 || itemsize == 0)
|
||||||
elog(ERROR, "safety check failed");
|
elog(ERROR, "cannot create vector array");
|
||||||
|
|
||||||
/* Ensure items are aligned to prevent UB */
|
/* Ensure items are aligned to prevent UB */
|
||||||
itemsize = MAXALIGN(itemsize);
|
itemsize = MAXALIGN(itemsize);
|
||||||
|
|||||||
Reference in New Issue
Block a user