From 059fd616cd868f0be9e88252f0ed305bbacfeece Mon Sep 17 00:00:00 2001 From: vyv03354 Date: Sat, 23 Feb 2013 20:46:20 +0900 Subject: [PATCH] Add a dummy byte at end of the CFF table to satisfy sanitizer Fixes #2674. --- src/fonts.js | 4 ++++ test/pdfs/JST2007-5.pdf.link | 1 + test/test_manifest.json | 9 +++++++++ 3 files changed, 14 insertions(+) create mode 100644 test/pdfs/JST2007-5.pdf.link diff --git a/src/fonts.js b/src/fonts.js index 9f04c9930..cf8241f11 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -6581,6 +6581,10 @@ var CFFCompiler = (function CFFCompilerClosure() { this.compilePrivateDicts([cff.topDict], [topDictTracker], output); + // If the font data ends with INDEX whose object data is zero-length, + // the sanitizer will bail out. Add a dummy byte to avoid that. + output.add([0]); + return output.data; }, encodeNumber: function CFFCompiler_encodeNumber(value) { diff --git a/test/pdfs/JST2007-5.pdf.link b/test/pdfs/JST2007-5.pdf.link new file mode 100644 index 000000000..ba66a4d43 --- /dev/null +++ b/test/pdfs/JST2007-5.pdf.link @@ -0,0 +1 @@ +http://kanji.zinbun.kyoto-u.ac.jp/%7Eyasuoka/publications/JST2007-5.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index d481fc57b..b1df455d8 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -876,6 +876,15 @@ "rounds": 1, "type": "eq" }, + { "id": "jst2007-5", + "file": "pdfs/JST2007-5.pdf", + "md5": "9efa6c37fc771b36a60535036d1910bb", + "rounds": 1, + "link": true, + "firstPage": 2, + "lastPage": 2, + "type": "eq" + }, { "id": "noembed-identity", "file": "pdfs/noembed-identity.pdf", "md5": "05d3803b6c22451e18cb60d8d8c75c0c",