diff --git a/src/core/type1_parser.js b/src/core/type1_parser.js index b6a32c321..13459ea70 100644 --- a/src/core/type1_parser.js +++ b/src/core/type1_parser.js @@ -512,6 +512,11 @@ const Type1Parser = (function Type1ParserClosure() { return (this.currentChar = this.stream.getByte()); } + prevChar() { + this.stream.skip(-2); + return (this.currentChar = this.stream.getByte()); + } + getToken() { // Eat whitespace and comments. let comment = false; @@ -604,6 +609,10 @@ const Type1Parser = (function Type1ParserClosure() { token = this.getToken(); // read in 'ND' or '|-' if (token === "noaccess") { this.getToken(); // read in 'def' + } else if (token === "/") { + // The expected 'ND' or '|-' token is missing, avoid swallowing + // the start of the next glyph (fixes issue14462_reduced.pdf). + this.prevChar(); } charstrings.push({ glyph, diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index afb7f86bd..068bdb065 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -483,6 +483,7 @@ !tiling-pattern-box.pdf !tiling-pattern-large-steps.pdf !issue13201.pdf +!issue14462_reduced.pdf !issue11555.pdf !issue12337.pdf !pr12564.pdf diff --git a/test/pdfs/issue14462_reduced.pdf b/test/pdfs/issue14462_reduced.pdf new file mode 100644 index 000000000..abea79c1b Binary files /dev/null and b/test/pdfs/issue14462_reduced.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 3064d8a33..777445554 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -3699,6 +3699,12 @@ "link": true, "type": "eq" }, + { "id": "issue14462", + "file": "pdfs/issue14462_reduced.pdf", + "md5": "afe38169322f8e124eaeae00f94ea596", + "rounds": 1, + "type": "eq" + }, { "id": "preistabelle", "file": "pdfs/preistabelle.pdf", "md5": "d2f0b2086160d4f3d325c79a5dc1fb4d",