Re: Bug fix to HTHost.c

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.

Done.

Thanks again,

-Jose

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