Abort on invalid truncation from uint64_t to uint32_t

Original idea by Bastiaan Stougie <bstougie@b-virtual.org>.