Hardened VectorArrayGet [skip ci]

This commit is contained in:
Andrew Kane
2026-07-27 16:14:25 -07:00
parent a6420355c5
commit 573040d3a2

View File

@@ -305,7 +305,7 @@ typedef IvfflatScanOpaqueData * IvfflatScanOpaque;
static inline Pointer
VectorArrayGet(VectorArray arr, int offset)
{
if (offset >= arr->maxlen)
if (offset < 0 || offset >= arr->maxlen)
elog(ERROR, "safety check failed");
return ((char *) arr->items) + (offset * arr->itemsize);