Browse Source

Merge pull request #1252 from notmasteryet/issue-1249

Check if glyphs are stored outside the glyf table
Artur Adib 13 years ago
parent
commit
d09c0fbfd3
  1. 10
      src/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue1249.pdf
  4. 6
      test/test_manifest.json

10
src/fonts.js

@ -1621,12 +1621,20 @@ var Font = (function FontClosure() { @@ -1621,12 +1621,20 @@ var Font = (function FontClosure() {
var locaData = loca.data;
// removing the invalid glyphs
var oldGlyfData = glyf.data;
var newGlyfData = new Uint8Array(oldGlyfData.length);
var oldGlyfDataLength = oldGlyfData.length;
var newGlyfData = new Uint8Array(oldGlyfDataLength);
var startOffset = itemDecode(locaData, 0);
var writeOffset = 0;
itemEncode(locaData, 0, writeOffset);
for (var i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
var endOffset = itemDecode(locaData, j);
if (endOffset > oldGlyfDataLength) {
// glyph end offset points outside glyf data, rejecting the glyph
itemEncode(locaData, j, writeOffset);
startOffset = endOffset;
continue;
}
var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset,
newGlyfData, writeOffset);
writeOffset += newLength;

1
test/pdfs/.gitignore vendored

@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
!scan-bad.pdf
!freeculture.pdf
!issue918.pdf
!issue1249.pdf
!smaskdim.pdf
!type4psfunc.pdf
!S2.pdf

BIN
test/pdfs/issue1249.pdf

Binary file not shown.

6
test/test_manifest.json

@ -417,6 +417,12 @@ @@ -417,6 +417,12 @@
"link": true,
"type": "eq"
},
{ "id": "issue1249-load",
"file": "pdfs/issue1249.pdf",
"md5": "4f81339fa09422a7db980f34ea963609",
"rounds": 1,
"type": "load"
},
{ "id": "liveprogramming",
"file": "pdfs/liveprogramming.pdf",
"md5": "7bd4dad1188232ef597d36fd72c33e52",

Loading…
Cancel
Save