mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-04 03:30:56 +08:00
Fix integer overflow in subvector() function (#530)
`end = start + count` can overflow if `start` is very large. That leads to a segfault later in the function. Add test case for it.
This commit is contained in:
committed by
GitHub
parent
ad3f811fa3
commit
14b351bc92
@@ -406,6 +406,8 @@ SELECT subvector('[1,2,3,4,5]'::halfvec, 3, -1);
|
||||
ERROR: halfvec must have at least 1 dimension
|
||||
SELECT subvector('[1,2,3,4,5]'::halfvec, -1, 2);
|
||||
ERROR: halfvec must have at least 1 dimension
|
||||
SELECT subvector('[1,2,3,4,5]'::halfvec, 2147483647, 10);
|
||||
ERROR: halfvec must have at least 1 dimension
|
||||
SELECT avg(v) FROM unnest(ARRAY['[1,2,3]'::halfvec, '[3,5,7]']) v;
|
||||
avg
|
||||
-----------
|
||||
|
||||
Reference in New Issue
Block a user