Decompression bomb protection

For #515.

Further discussion welcome.