[HACKERS] segfault in HEAD when too many nested functions call - Mailing list pgsql-hackers

From Julien Rouhaud
Subject [HACKERS] segfault in HEAD when too many nested functions call
Date
Msg-id b0af9eaa-130c-60d0-9e4e-7a135b1e0c76@dalibo.com
Whole thread Raw
Responses Re: [HACKERS] segfault in HEAD when too many nested functions call
List pgsql-hackers
Hello,

Since b8d7f053c5c2bf2a7e8734fe3327f6a8bc711755 (Andres in Cc), if you
write queries which result in infinite recursion (or just too many
nested function calls), execution ends with segfault instead of intended
exhausted max_stack_depth:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000df851e in DirectFunctionCall1Coll (
    func=<error reading variable: Cannot access memory at address
0x7ffef5972f98>,
    collation=<error reading variable: Cannot access memory at address
0x7ffef5972f94>,
    arg1=<error reading variable: Cannot access memory at address
0x7ffef5972f88>) at fmgr.c:708

Please find attached a trivial patch to fix this.  I'm not sure
ExecMakeTableFunctionResult() is the best or only place that needs to
check the stack depth.

I also attached a simple sql file to reproduce the issue if needed.
Should I add a regression test based on it?

-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] [WIP] Zipfian distribution in pgbench
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Pluggable storage