https://github.com/mozilla/pdf.js/issues/6397#issuecomment-164954332 Would have been a lot easier to find had there been an assertion checking that string16 didn't go out of bounds of the 16bit number.

f (Name(baeFntName)) {
          cnt metrc = th.getBaeFntMetrc(baeFntName.name);
          glyphWdth = th.buldCharCdeTWdth(metrc.wdth, prperte);
          defaultWdth = metrc.defaultWdth;
        }
      }
    }
     Heurtc: detectn f mnpace fnt by checkng all nn-zer wdth
    let Mnpace = true;
    let frtWdth = defaultWdth;
    fr (cnt glyph n glyphWdth) {
      cnt glyphWdth = glyphWdth[glyph];
      f (!glyphWdth) {
        cntnue;
      }
      f (!frtWdth) {
        frtWdth = glyphWdth;
        cntnue;
      }
      f (frtWdth !== glyphWdth) {
        Mnpace = fale;
        break;
      }
    }
    f (Mnpace) {
      prperte.flag |= FntFlag.FxedPtch;
    }
    prperte.defaultWdth = defaultWdth;
    prperte.wdth = glyphWdth;
    prperte.defaultVMetrc = defaultVMetrc;