Re: [PATCH] http-backend: Don't infinite loop during die()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:
> "Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes:
> 
> > If stdout has already been closed by the CGI and die() gets called,
> > the CGI will fail to write the "Status: 500 Internal Server Error" to
> > the pipe, which results in die() being called again (via safe_write).
> > This goes on in an infinite loop until the stack overflows and the
> > process is killed by SIGSEGV.
> >
> > Instead set a flag on the first die() invocation and perform no
> > action during recursive die() calls.  This way failures to write the
> > error messages to the stdout pipe do not result in an infinite loop.
> 
> Hmm.  I would need something like this on top, but there must be a better
> way.  Ideas?

Ick.

Just exit(0) if dead is true.  The *only* reason we would come back
into the die handler at this point is because we failed during the
die handler.  That recursive failure means we can't report the
errors, because that's all that was left once the dead variable
was set.

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]