Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9ae257

Browse files
committed
The sanity check added to array_recv() wa a bit too tight; we must
continue to accept an empty array with dimension information. array_send()can output such arrays.Per report from Vladimir Shakhov.
1 parent7413969 commitc9ae257

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

‎src/backend/utils/adt/arrayfuncs.c

Lines changed: 13 additions & 9 deletions
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.164 2010/02/26 02:01:07 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.165 2010/08/11 19:12:27 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1213,17 +1213,21 @@ array_recv(PG_FUNCTION_ARGS)
12131213

12141214
for (i=0;i<ndim;i++)
12151215
{
1216-
intub;
1217-
12181216
dim[i]=pq_getmsgint(buf,4);
12191217
lBound[i]=pq_getmsgint(buf,4);
12201218

1221-
ub=lBound[i]+dim[i]-1;
1222-
/* overflow? */
1223-
if (lBound[i]>ub)
1224-
ereport(ERROR,
1225-
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1226-
errmsg("integer out of range")));
1219+
/*
1220+
* Check overflow of upper bound. (ArrayNItems() below checks that
1221+
* dim[i] >= 0)
1222+
*/
1223+
if (dim[i]!=0)
1224+
{
1225+
intub=lBound[i]+dim[i]-1;
1226+
if (lBound[i]>ub)
1227+
ereport(ERROR,
1228+
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
1229+
errmsg("integer out of range")));
1230+
}
12271231
}
12281232

12291233
/* This checks for overflow of array dimensions */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp