Resources scarcity in programing
December 17th, 2007
Lots of programs are written with the pervasive assumption that enough resources will be available. Many programs don’t even think about what will happen if not enough resources are available, and sometimes they do the wrong thing.
So look to see
- what happens if there’s not enough memory and some allocations fail, usually returning NULL from malloc or new
- if it’s possible for untrusted users to use up all the resources (which can be a denial-of-service problem even if the program handles it without allowing intrusions; this problem is endemic throughout most software, though)
- what happens if the program runs out of fds (and whether it’s possible) — open() will return -1
- what happens if the program can’t fork(), or if its child dies during initialization due to resource starvation