Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 32af13f

Browse files
committed
Add missing check for too-few-inputs when replacing a zero-dimensional
array.
1 parent 327d86c commit 32af13f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/utils/adt/arrayfuncs.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.103 2004/06/06 00:41:27 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.104 2004/06/08 20:28:21 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1837,6 +1837,12 @@ array_set_slice(ArrayType *array,
18371837
lb[i] = lowerIndx[i];
18381838
}
18391839

1840+
/* complain if too few source items; we ignore extras, however */
1841+
if (nelems < ArrayGetNItems(nSubscripts, dim))
1842+
ereport(ERROR,
1843+
(errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
1844+
errmsg("source array too small")));
1845+
18401846
return construct_md_array(dvalues, nSubscripts, dim, lb, elmtype,
18411847
elmlen, elmbyval, elmalign);
18421848
}

0 commit comments

Comments
 (0)