stack overflow bug in ofstream::operator<<
Tue Jun 28 17:59:00 GMT 2005
On Tue, Jun 28, 2005 at 06:41:09PM +0100, Dave Korn wrote:
>Well, I was proposing testing how much space was available on the
>stack, so that we never alloca past the bottom of it, and hence don't
>*need* any kind of signal handler.
If we are going to check how much stack space is available, it might be
nice to make a __alloca_which_returns_NULL which returns NULL when there
isn't enough space available. That could be used for other things.
OTOH, the functionality I'm adding would allow you to do this:
if (efault.faulted ())
p = malloc (n);
malloced = true;
p = alloca (n);
malloced = false;
If alloca actually SEGVs when it tries to allocate too much space then
this would just allocate space with malloc whenever alloca fails.
This is still a more heavy weight solution than just checking the stack
to see what's available, though.
More information about the Cygwin-developers