W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2000

Re: Bug fix to HTHost.c

From: <jose.kahan@w3.org>
Date: Wed, 7 Jun 100 16:37:24 +0200 (MET DST)
Message-Id: <200006071437.QAA07577@tuvalu.inrialpes.fr>
To: peter.kocks@baygate.com
Cc: www-lib@w3.org
Hello Peter,

Thanks for your report and patch.

In our previous episode, Peter Kocks said:
> I can reproducibly crash a custom webbot program
> that uses libwww.  The program crashes under a
> couple of circumstances (gdb stack traces are
> attached at the bottom of this message), but
> both are related to two lines of code in HTHost.c
> In HTHost.c, starting at line 1099 (current cvs)
> HTChannel_delete(host->channel, status);
> host->channel = NULL;
> The second line (host->channel = NULL) is both
> unnecessary and causes libwww crash under certain
> conditions.

You're right about it. host->channel should only be set to NULL if
HTChannel_delete return TRUE. Otherwise, it means that the channel is
still being used.

  For  example, any subsequent code that
> calls HTChannel_socket(host->channel)) will return
> a socket number of "-1".  This will cause a
> segfault if something is keyed on socket
> number.  E.g. HTEventList_unregister().

This is a bug, but it's that those functions should take into account
that INVSOC is a non-existent socket :) I added some protection for
the _register and _unregister functions. I was already doing so in my own
Amaya callback functions (for interfacing with Xt).

Do you know of some other places where having a -1 (INVSOC) socket value
may be causing problems?

> I'm not sure what the procedure is, but I'd
> like the line host->channel = NULL deleted from
> the code base because it is causing some
> of my programs to crash.


Thanks again,

Received on Wednesday, 7 June 2000 10:37:48 UTC

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