
Attach (recommended) or Link to PDF file here:
[NAPEN16171380959.pdf](https://github.com/mozilla/pdf.js/files/6143802/NAPEN16171380959.pdf)

Configuration:
- Web browser and its version: Firefox 88 Nightly
- Operating system and its version: Windows 10
- PDF.js version:
- Is a browser extension: No

What went wrong? (add screenshot)
![](https://user-media-prod-cdn.itsre-sumo.mozilla.net/uploads/images/2021-03-15-10-58-27-ce2796.png)


var ranges = getRanges(glyphs, numGlyphs);
    var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
    var cmap =
      "\x00\x00" + 
      string16(numTables) + 
      "\x00\x03" + 
      "\x00\x01" + 
      string32(4 + numTables * 8); 
    var i, ii, j, jj;
    for (i = ranges.length - 1; i >= 0; --i) {
      if (ranges[i][0] <= 0xffff) {
        break;
      }
    }
    var bmpLength = i + 1;
    if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
      ranges[i][1] = 0xfffe;
    }
    var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
    var segCount = bmpLength + trailingRangesCount;
    var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
    
    var startCount = "";
    var endCount = "";
    var idDeltas = "";
    var idRangeOffsets = "";