|
|
|
|
@ -333,8 +333,8 @@ array_in(PG_FUNCTION_ARGS) |
|
|
|
|
if (!AllocSizeIsValid(nbytes)) |
|
|
|
|
ereturn(escontext, (Datum) 0, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (hasnulls) |
|
|
|
|
@ -492,8 +492,8 @@ ReadArrayDimensions(char **srcptr, int *ndim_p, int *dim, int *lBound, |
|
|
|
|
pg_add_s32_overflow(ub, 1, &ub)) |
|
|
|
|
ereturn(escontext, false, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
|
|
|
|
|
dim[ndim] = ub; |
|
|
|
|
ndim++; |
|
|
|
|
@ -725,8 +725,8 @@ ReadArrayStr(char **srcptr, |
|
|
|
|
if (maxitems >= MaxArraySize) |
|
|
|
|
ereturn(escontext, false, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
maxitems = Min(maxitems * 2, MaxArraySize); |
|
|
|
|
values = repalloc_array(values, Datum, maxitems); |
|
|
|
|
nulls = repalloc_array(nulls, bool, maxitems); |
|
|
|
|
@ -1531,8 +1531,8 @@ ReadArrayBinary(StringInfo buf, |
|
|
|
|
if (!AllocSizeIsValid(totbytes)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
*hasnulls = hasnull; |
|
|
|
|
@ -2339,8 +2339,8 @@ array_set_element(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedbefore, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
lb[0] = indx[0]; |
|
|
|
|
if (addedbefore > 1) |
|
|
|
|
newhasnulls = true; /* will insert nulls */ |
|
|
|
|
@ -2354,8 +2354,8 @@ array_set_element(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedafter, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
if (addedafter > 1) |
|
|
|
|
newhasnulls = true; /* will insert nulls */ |
|
|
|
|
} |
|
|
|
|
@ -2616,8 +2616,8 @@ array_set_element_expanded(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedbefore, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
lb[0] = indx[0]; |
|
|
|
|
dimschanged = true; |
|
|
|
|
if (addedbefore > 1) |
|
|
|
|
@ -2632,8 +2632,8 @@ array_set_element_expanded(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedafter, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
dimschanged = true; |
|
|
|
|
if (addedafter > 1) |
|
|
|
|
newhasnulls = true; /* will insert nulls */ |
|
|
|
|
@ -2893,8 +2893,8 @@ array_set_slice(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[i], 1, &dim[i])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
|
|
|
|
|
lb[i] = lowerIndx[i]; |
|
|
|
|
} |
|
|
|
|
@ -2947,8 +2947,8 @@ array_set_slice(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedbefore, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
lb[0] = lowerIndx[0]; |
|
|
|
|
if (addedbefore > 1) |
|
|
|
|
newhasnulls = true; /* will insert nulls */ |
|
|
|
|
@ -2962,8 +2962,8 @@ array_set_slice(Datum arraydatum, |
|
|
|
|
pg_add_s32_overflow(dim[0], addedafter, &dim[0])) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxArraySize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxArraySize))); |
|
|
|
|
if (addedafter > 1) |
|
|
|
|
newhasnulls = true; /* will insert nulls */ |
|
|
|
|
} |
|
|
|
|
@ -3303,8 +3303,8 @@ array_map(Datum arrayd, |
|
|
|
|
if (!AllocSizeIsValid(nbytes)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -3543,8 +3543,8 @@ construct_md_array(Datum *elems, |
|
|
|
|
if (!AllocSizeIsValid(nbytes)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Allocate and initialize result array */ |
|
|
|
|
@ -5375,8 +5375,8 @@ accumArrayResult(ArrayBuildState *astate, |
|
|
|
|
if (!AllocSizeIsValid(astate->alen * sizeof(Datum))) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
astate->dvalues = (Datum *) |
|
|
|
|
repalloc(astate->dvalues, astate->alen * sizeof(Datum)); |
|
|
|
|
astate->dnulls = (bool *) |
|
|
|
|
@ -6214,8 +6214,8 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs, |
|
|
|
|
!AllocSizeIsValid(totbytes)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This addition can't overflow, but it might cause us to go past |
|
|
|
|
@ -6558,8 +6558,8 @@ array_replace_internal(ArrayType *array, |
|
|
|
|
if (!AllocSizeIsValid(nbytes)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%d)", |
|
|
|
|
(int) MaxAllocSize))); |
|
|
|
|
errmsg("array size exceeds the maximum allowed (%zu)", |
|
|
|
|
MaxAllocSize))); |
|
|
|
|
} |
|
|
|
|
nresult++; |
|
|
|
|
} |
|
|
|
|
|