mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 22:56:55 +08:00
Added check for indexing overflow
This commit is contained in:
@@ -204,6 +204,9 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers)
|
|||||||
double dxcx;
|
double dxcx;
|
||||||
double dxc;
|
double dxc;
|
||||||
|
|
||||||
|
/* Ensure indexing does not overflow */
|
||||||
|
Assert(numCenters * numCenters <= INT_MAX);
|
||||||
|
|
||||||
/* Calculate allocation sizes */
|
/* Calculate allocation sizes */
|
||||||
Size samplesSize = VECTOR_ARRAY_SIZE(samples->maxlen, samples->dim);
|
Size samplesSize = VECTOR_ARRAY_SIZE(samples->maxlen, samples->dim);
|
||||||
Size centersSize = VECTOR_ARRAY_SIZE(centers->maxlen, centers->dim);
|
Size centersSize = VECTOR_ARRAY_SIZE(centers->maxlen, centers->dim);
|
||||||
|
|||||||
Reference in New Issue
Block a user