block/dmg: validate chunk size to avoid overflow