httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+apa...@sunstarsys.com>
Subject Re: Fwd: segfault in Apache::Upload::fh with libapreq 1.1rc2
Date Sun, 05 Jan 2003 18:40:36 GMT
Sven Geisler <sgeisler@aeccom.com> writes:

> > An: Stas Bekman <stas@stason.org>
> > Betreff: Re: segfault in Apache::Upload::fh with libapreq 1.1rc2

[...]

> >>     fp = ApacheUpload_fh(upload);
> >>     if ( !fp )
> >>        XSRETURN_UNDEF;
> >>
> >> is that the client code expects a file, and we return undef here.
> >>
> >
> > $upload->fh was set to zero (from init). Without my patch the perl 
> > code $upload->fh produced a segfault. Regarding your comment my 
> > questions is: how do I find out that there is a uploaded file?

If there's no files being uploaded, $r->upload will return an 
empty list (in list context).  

In scalar context, $r->upload *should* return an undef in this
situation  (I'm not sure it actually does that, though).

> > More about my circumstances:
> > I use a html form (multipart form data) with two file upload fields. I 
> > got a segfault with $upload->fh if the user selects no files. I use 
> > $upload->fh to find out if there is a upload. My patch is for this 
> > case.

Preventing a segfault here is prudent, so I definitely agree that 
we need to incorporate this fix into 1.1.  However, this situation 
*should not* happen, unless either 

  1) an error occurred during parsing (look in $apr->status?),
  2) you're using an UPLOAD_HOOK, and the hook function isn't
     creating the necessary tempfiles.

If neither of these are true, uploads should always have non-null
tempfiles attached, and $upload->fh should not segfault.

> > I got another segfault if the user select a file. My handler receives 
> > the file. This request handled well. I got a segfault with the next 
> > request on this process. This looks like the same segfault that I saw 
> > with libapreq 1.0 and perl 5.8.0.

We need to see a stack trace of the core (I suspect a duped
filehandle is being freed twice, but I haven't been able to get
my box to segfault yet).  Once again, would you please post the 
particulars so apreq-dev can collectively figure this issue out?

Thanks.

-- 
Joe Schaefer

Mime
View raw message