Source: https://research.cs.wisc.edu/mist/papers/safeopen.pdf