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

Lines changed: 7 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy