1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Prevent adding invalid values in CFFDict_setByKey (bug 1068432)

In the font in question, there are a couple of `topDict` entries that have invalid values (`0xF 0xF`, i.e. just eof markers without any actual numbers).
This causes the `parseFloatOperand` function, inside `CFFParser_parseDict`, to return `NaN`. Currently we pass this broken font onto the browser, which OTS unsurprisingly rejects.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1068432.
This commit is contained in:
Jonas Jenwald 2016-05-07 18:23:47 +02:00
parent 8b605b6980
commit c9b6de3b16
5 changed files with 22 additions and 0 deletions

View file

@ -95,6 +95,15 @@ describe('CFFParser', function() {
expect(topDict.getByName('Private')).toEqual([45, 102]);
});
it('refuses to add topDict key with invalid value (bug 1068432)',
function () {
var topDict = cff.topDict;
var defaultValue = topDict.getByName('UnderlinePosition');
topDict.setByKey(/* [12, 3] = */ 3075, [NaN]);
expect(topDict.getByName('UnderlinePosition')).toEqual(defaultValue);
});
it('parses a CharString having cntrmask', function() {
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize