Re: [HACKERS] Preventing stack-overflow crashes (improving on

2003-12-31 Thread Matthew Kirkwood
On Wed, 31 Dec 2003, Tom Lane wrote: > > Is ABS enough on a 64-bit architecture ? > > That was pseudocode, I wasn't actually planning to rely on a function. > Something more like > > longdiff; FWIW, ISO has a ptrdiff_t, which may be useful here. Matthew. > diff = stack_base_ptr

Re: [HACKERS] Preventing stack-overflow crashes (improving on

2003-12-31 Thread Larry Rosenman
--On Wednesday, December 31, 2003 11:20:49 -0500 Tom Lane <[EMAIL PROTECTED]> wrote: Gaetano Mendola <[EMAIL PROTECTED]> writes: Is ABS enough on a 64-bit architecture ? That was pseudocode, I wasn't actually planning to rely on a function. Something more like long diff; diff = stack_

Re: [HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-31 Thread Tom Lane
Gaetano Mendola <[EMAIL PROTECTED]> writes: > Is ABS enough on a 64-bit architecture ? That was pseudocode, I wasn't actually planning to rely on a function. Something more like longdiff; diff = stack_base_ptr - &stack_top_loc; if (diff < 0) diff = -di

Re: [HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-31 Thread Gaetano Mendola
Tom Lane wrote: Comments? Really ugly but effective. Is ABS enough on a 64-bit architecture ? Or is better use labs ? Regards Gaetano Mendola ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscrib

Re: [HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-30 Thread Tom Lane
Mike Mascari <[EMAIL PROTECTED]> writes: > Would it make sense to also have a nice little global function and/or > macro available for the author of C-language recursive functions to > perform a depth test before recursing? Yeah, I envision presenting this as a nice little macro along the lines

Re: [HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-30 Thread Mike Mascari
Bruce Momjian wrote: Sounds like a great approach to me. If it doesn't work, we will find out during beta testing. Would it make sense to also have a nice little global function and/or macro available for the author of C-language recursive functions to perform a depth test before recursing?

Re: [HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-30 Thread Bruce Momjian
Sounds like a great approach to me. If it doesn't work, we will find out during beta testing. --- Tom Lane wrote: > We've had a couple of complaints in the past about recursive functions > crashing the server by overflowing

[HACKERS] Preventing stack-overflow crashes (improving on max_expr_depth)

2003-12-30 Thread Tom Lane
We've had a couple of complaints in the past about recursive functions crashing the server by overflowing the C execution stack. There is a GUC variable max_expr_depth that is intended to prevent this sort of problem for the particular case of overly complex arithmetic expressions, but it's diffic