summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurjeet Singh2023-02-07 18:48:06 +0000
committerGurjeet Singh2023-02-07 18:48:06 +0000
commit4a4967a88dac56a106d286c027e94942bee9df34 (patch)
tree96b594b8ae0d7601c025ed1875618336778b3cff
parent2cbbffff05b853733ae19ca7047cfeb9a346a497 (diff)
First version of the patchassert_nargs_is_large_enough
-rw-r--r--src/include/fmgr.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index b120f5e7fe..a445ac56b9 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -206,7 +206,7 @@ extern void fmgr_symbol(Oid functionId, char **mod, char **fn);
* If function is not marked "proisstrict" in pg_proc, it must check for
* null arguments using this macro. Do not try to GETARG a null argument!
*/
-#define PG_ARGISNULL(n) (fcinfo->args[n].isnull)
+#define PG_ARGISNULL(n) (AssertMacro(n < PG_NARGS()), fcinfo->args[n].isnull)
/*
* Support for fetching detoasted copies of toastable datatypes (all of
@@ -265,7 +265,7 @@ extern struct varlena *pg_detoast_datum_packed(struct varlena *datum);
/* Macros for fetching arguments of standard types */
-#define PG_GETARG_DATUM(n) (fcinfo->args[n].value)
+#define PG_GETARG_DATUM(n) (AssertMacro(n < PG_NARGS()), fcinfo->args[n].value)
#define PG_GETARG_INT32(n) DatumGetInt32(PG_GETARG_DATUM(n))
#define PG_GETARG_UINT32(n) DatumGetUInt32(PG_GETARG_DATUM(n))
#define PG_GETARG_INT16(n) DatumGetInt16(PG_GETARG_DATUM(n))