mirror of
https://github.com/pgvector/pgvector.git
synced 2026-06-30 09:41:15 +08:00
Check bounds unconditionally in array_to_vector(). (#127)
Presently, array_to_vector()'s call to CheckDim() is skipped when typmod != -1, which allows for bypassing VECTOR_MAX_DIM. To fix, call Check[Expected]Dim() unconditionally. CheckExpectedDim() takes no action when typmod == -1, so there's no need to guard it with an 'if' statement.
This commit is contained in:
@@ -396,10 +396,8 @@ array_to_vector(PG_FUNCTION_ARGS)
|
||||
get_typlenbyvalalign(ARR_ELEMTYPE(array), &typlen, &typbyval, &typalign);
|
||||
deconstruct_array(array, ARR_ELEMTYPE(array), typlen, typbyval, typalign, &elemsp, &nullsp, &nelemsp);
|
||||
|
||||
if (typmod == -1)
|
||||
CheckDim(nelemsp);
|
||||
else
|
||||
CheckExpectedDim(typmod, nelemsp);
|
||||
CheckDim(nelemsp);
|
||||
CheckExpectedDim(typmod, nelemsp);
|
||||
|
||||
result = InitVector(nelemsp);
|
||||
for (i = 0; i < nelemsp; i++)
|
||||
|
||||
Reference in New Issue
Block a user