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

Commit59fb29c

Browse files
committed
Switch order of tests to avoid possible Assert failure for
"array_agg_finalfn(null)". We should modify pg_proc entries to prevent thisquery from being accepted, but let's just make the function itself secure too.Per my note of today.
1 parentf3e122f commit59fb29c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.28 2009/01/01 17:23:48 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/utils/adt/array_userfuncs.c,v 1.29 2009/06/09 18:15:04 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -520,14 +520,19 @@ array_agg_finalfn(PG_FUNCTION_ARGS)
520520
intdims[1];
521521
intlbs[1];
522522

523+
/*
524+
* Test for null before Asserting we are in right context. This is
525+
* to avoid possible Assert failure in 8.4beta installations, where
526+
* it is possible for users to create NULL constants of type internal.
527+
*/
528+
if (PG_ARGISNULL(0))
529+
PG_RETURN_NULL();/* returns null iff no input values */
530+
523531
/* cannot be called directly because of internal-type argument */
524532
Assert(fcinfo->context&&
525533
(IsA(fcinfo->context,AggState)||
526534
IsA(fcinfo->context,WindowAggState)));
527535

528-
if (PG_ARGISNULL(0))
529-
PG_RETURN_NULL();/* returns null iff no input values */
530-
531536
state= (ArrayBuildState*)PG_GETARG_POINTER(0);
532537

533538
dims[0]=state->nelems;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp