asfenc: fix some possible integer overflows