W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

Solution for possible crash if using SSL

From: Kallweit, Heiner <Heiner.Kallweit@commerzbank.com>
Date: Wed, 26 Jul 2000 14:09:02 +0200
Message-ID: <01EBDB2D6DFDD211A98200805FF50CF901188D64@SV002871>
To: "'www-lib@w3.org'" <www-lib@w3.org>

I ran into serious trouble when using a CGI-programm that (not only)
requests via Libwww and SSL. Every 100th request I got a core dump.
Eventually I found out that there is a recursive function call. To cut a
story short: HTHost_forceFlush -> HTTPEvent_Flush ->
-> HTSSLWriter_write -> HTSSLReader_read -> HTHost_forceFlush
If your machine is fast enough (mine was) this can cause a stack overflow.
I stopped the recursion by changing HTHost_forceFlush to the following:

PUBLIC int HTHost_forceFlush(HTHost * host)
    static BOOL in_flush=NO;
    HTNet * targetNet = (HTNet *) HTList_lastObject(host->pipeline);
    int ret;
    if (in_flush || targetNet == NULL) return HT_ERROR;
    HTTRACE(CORE_TRACE, "Host Event.. FLUSH passed to `%s\'\n" _
    host->forceWriteFlush = in_flush = YES;
    while ((ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel),
targetNet->event.param, Event_FLUSH))==HT_WOULD_BLOCK);
    host->forceWriteFlush = in_flush = NO;
    return ret;

Until now I found no side effect.

Regards, Heiner
Received on Wednesday, 26 July 2000 08:09:44 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:53 UTC