This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stack overflow bug in ofstream::operator<<


On Jun 30 15:54, Corinna Vinschen wrote:
> Ok.  I take it then that you don't like the way I solved it.  Implementing
> some alloca like function with exception handling is certainly more i386
> assembler than I understand.

Well, my solution would work as a replacement, too:

#define ALLOCA(siz)     \
        ({ \
          extern unsigned long _size_of_stack_reserve__; \
          register char *_curstack __asm__ ("%esp"); \
          size_t size = (siz); \
          ((size_t) ((_curstack - (_tlsbase \
                                   - (size_t) &_size_of_stack_reserve__) \
                    ) / 65536) * 65536 > size) ? alloca (size) : NULL;\
        })


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]