Support Type1 font files with incomplete /CharStrings definitions (issue 14462)
Please refer to https://www.pdfa.org/norm-refs/Type1Fonts.pdf#page=15 for the expected format for the /CharStrings entries. In the referenced PDF document the /CharStrings are missing the expected end-token, which causes us to swallow the start of the next glyph name.
This commit is contained in:
parent
f955b0e20c
commit
a13ae5d97d
@ -512,6 +512,11 @@ const Type1Parser = (function Type1ParserClosure() {
|
|||||||
return (this.currentChar = this.stream.getByte());
|
return (this.currentChar = this.stream.getByte());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prevChar() {
|
||||||
|
this.stream.skip(-2);
|
||||||
|
return (this.currentChar = this.stream.getByte());
|
||||||
|
}
|
||||||
|
|
||||||
getToken() {
|
getToken() {
|
||||||
// Eat whitespace and comments.
|
// Eat whitespace and comments.
|
||||||
let comment = false;
|
let comment = false;
|
||||||
@ -604,6 +609,10 @@ const Type1Parser = (function Type1ParserClosure() {
|
|||||||
token = this.getToken(); // read in 'ND' or '|-'
|
token = this.getToken(); // read in 'ND' or '|-'
|
||||||
if (token === "noaccess") {
|
if (token === "noaccess") {
|
||||||
this.getToken(); // read in 'def'
|
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({
|
charstrings.push({
|
||||||
glyph,
|
glyph,
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -483,6 +483,7 @@
|
|||||||
!tiling-pattern-box.pdf
|
!tiling-pattern-box.pdf
|
||||||
!tiling-pattern-large-steps.pdf
|
!tiling-pattern-large-steps.pdf
|
||||||
!issue13201.pdf
|
!issue13201.pdf
|
||||||
|
!issue14462_reduced.pdf
|
||||||
!issue11555.pdf
|
!issue11555.pdf
|
||||||
!issue12337.pdf
|
!issue12337.pdf
|
||||||
!pr12564.pdf
|
!pr12564.pdf
|
||||||
|
BIN
test/pdfs/issue14462_reduced.pdf
Normal file
BIN
test/pdfs/issue14462_reduced.pdf
Normal file
Binary file not shown.
@ -3699,6 +3699,12 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue14462",
|
||||||
|
"file": "pdfs/issue14462_reduced.pdf",
|
||||||
|
"md5": "afe38169322f8e124eaeae00f94ea596",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "preistabelle",
|
{ "id": "preistabelle",
|
||||||
"file": "pdfs/preistabelle.pdf",
|
"file": "pdfs/preistabelle.pdf",
|
||||||
"md5": "d2f0b2086160d4f3d325c79a5dc1fb4d",
|
"md5": "d2f0b2086160d4f3d325c79a5dc1fb4d",
|
||||||
|
Loading…
Reference in New Issue
Block a user