check for overflows when calculating allocation sizes
check for overflows when calculating allocation sizes

This addresses overflow issues that were discovered by mmcco
using AFL.

ender672/farbfeld-resize