mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Add missing check_stack_depth() to some recursive functions
Reported-by: Egor Chindyaskin, Alexander Lakhin Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru
This commit is contained in:
@ -7035,6 +7035,9 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
ObjectAddress address;
|
||||
TupleDesc tupdesc;
|
||||
|
||||
/* since this function recurses, it could be driven to stack overflow */
|
||||
check_stack_depth();
|
||||
|
||||
/* At top level, permission check was done in ATPrepCmd, else do it */
|
||||
if (recursing)
|
||||
ATSimplePermissions((*cmd)->subtype, rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
||||
@ -9083,6 +9086,10 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
|
||||
|
||||
/* Initialize addrs on the first invocation */
|
||||
Assert(!recursing || addrs != NULL);
|
||||
|
||||
/* since this function recurses, it could be driven to stack overflow */
|
||||
check_stack_depth();
|
||||
|
||||
if (!recursing)
|
||||
addrs = new_object_addresses();
|
||||
|
||||
@ -11636,6 +11643,9 @@ ATExecAlterConstrRecurse(Constraint *cmdcon, Relation conrel, Relation tgrel,
|
||||
Oid refrelid;
|
||||
bool changed = false;
|
||||
|
||||
/* since this function recurses, it could be driven to stack overflow */
|
||||
check_stack_depth();
|
||||
|
||||
currcon = (Form_pg_constraint) GETSTRUCT(contuple);
|
||||
conoid = currcon->oid;
|
||||
refrelid = currcon->confrelid;
|
||||
@ -12716,6 +12726,9 @@ dropconstraint_internal(Relation rel, HeapTuple constraintTup, DropBehavior beha
|
||||
/* Guard against stack overflow due to overly deep inheritance tree. */
|
||||
check_stack_depth();
|
||||
|
||||
/* since this function recurses, it could be driven to stack overflow */
|
||||
check_stack_depth();
|
||||
|
||||
/* At top level, permission check was done in ATPrepCmd, else do it */
|
||||
if (recursing)
|
||||
ATSimplePermissions(AT_DropConstraint, rel, ATT_TABLE | ATT_FOREIGN_TABLE);
|
||||
|
Reference in New Issue
Block a user