[vlc-devel] [vlc-commits] commit: httpd: gracefully handle too large request bodies (Pierre Ynard )

Rémi Denis-Courmont remi at remlab.net
Sat Dec 11 01:09:33 CET 2010


On Sat, 11 Dec 2010 01:01:26 +0100 (CET), git at videolan.org wrote:
> vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Dec 11
> 00:58:18 2010 +0100| [2e1b9e44719618eb97b3850d05096753fd7d3617] |
> committer: Pierre Ynard
> 
> httpd: gracefully handle too large request bodies
> 
> Return a 413 error instead of crashing

That won't really work the way you'd want though.

malloc() returns NULL if it's out of address space, but it does not usually
return NULL if it's out of memory. So in practice, this will catch
ridiculously large Content-Length such as 2 gigabytes, but not large
requests such as a few hundred megabytes. Instead, the process will get
killed later when it tries to write and taint new memory pages.

In other words, the only really reliable way to handle out-of-memory on the
server side is to run multiple processes, where each child process serves a
different client. Then a given client can only screw its own self.

As an alternative, you may put arbitrarily low limits on memory
allocations.

-- 
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis




More information about the vlc-devel mailing list