From 30ef143737621478e4ec11deec1d97cb422143a0 Mon Sep 17 00:00:00 2001 From: pdobacz <5735525+pdobacz@users.noreply.github.com> Date: Wed, 25 May 2022 10:31:43 +0200 Subject: [PATCH] Protect against find_agg_funcs(0) on uninitialized oid cache --- src/aggregation/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aggregation/common.c b/src/aggregation/common.c index cfe40e2d..6c341039 100644 --- a/src/aggregation/common.c +++ b/src/aggregation/common.c @@ -22,9 +22,9 @@ PG_FUNCTION_INFO_V1(anon_agg_state_finalfn); const AnonAggFuncs *find_agg_funcs(Oid oid) { - Assert(OidIsValid(oid)); - - if (oid == g_oid_cache.anon_count_star) + if (!OidIsValid(oid)) + return NULL; + else if (oid == g_oid_cache.anon_count_star) return &g_count_star_funcs; else if (oid == g_oid_cache.anon_count_value) return &g_count_value_funcs;