cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Segmentation fault (core dumped)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 10 Sep 2001 11:11:42 +0200 (MET DST)

On Mon, 10 Sep 2001, Cris Bailiff wrote:

> means that WRITEHEADERFUNCTION can get called even when WRITEHEADER is
> NULL (no header output stream is defined), which is what was happening.
> This was previously impossible.

Ah, good tracking Cris!

> Initially, the prototype signature of a curl IO callback was (by
> definition) the same prototype as that of fwrite/fread, with stream of
> type (FILE *). The callbacks are now more widely interpreted with stream
> of type (void *), so I suppose its now legal for stream to be NULL. The
> default curl callback, fwrite, segfaults if given a NULL stream, so I'm
> sure the change may cause other applications which define
> WRITEHEADERFUNCTION to fault if they expect stream != NULL. As
> WRITEHEADERFUNCTION is only since 7.7.2, its probably not widespread.

I always intended the stream to be legally assigned to NULL. Everything else
was just effects of code doing other assumptions.

> I'll whip up a patch for Curl::easy to discard the header data if stream
> == NULL, and check it in, if thats OK with you Daniel

Oh, certainly!

> I'd like to extend the test harness and do other Curl::easy work
> previously discussed, but I don't have time just now....

Do you think you could write a little TODO or something on what you think
should be done? Perhaps that would be just as time-consuming as doing the
actual fixes... I just figure it might be easier to find people to help out
with this if we get some more docs around what to do and how the things
work...

I could even have a go at something, but I've never done any perl XS stuff so
I wouldn't even know where to start!

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-09-10