Adjust the heuristics for handling of incomplete path operators (issue 14917)
This limits the heuristics for handling of incomplete path operators, see PR 9838, to only apply to *sequences* of such operators. In practice a couple of invalid path operators are (hopefully) unlikely to completely break rendering, whereas a sequence of them will easily lead to fairly chaotic rendering artifacts.
This commit is contained in:
parent
46e4a305eb
commit
5a774b7ed3
@ -4765,6 +4765,7 @@ class EvaluatorPreprocessor {
|
||||
});
|
||||
this.stateManager = stateManager;
|
||||
this.nonProcessedArgs = [];
|
||||
this._isPathOp = false;
|
||||
this._numInvalidPathOPS = 0;
|
||||
}
|
||||
|
||||
@ -4810,6 +4811,13 @@ class EvaluatorPreprocessor {
|
||||
const numArgs = opSpec.numArgs;
|
||||
let argsLength = args !== null ? args.length : 0;
|
||||
|
||||
// If the *previous* command wasn't a path operator, reset the heuristic
|
||||
// used with incomplete path operators below (fixes issue14917.pdf).
|
||||
if (!this._isPathOp) {
|
||||
this._numInvalidPathOPS = 0;
|
||||
}
|
||||
this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath;
|
||||
|
||||
if (!opSpec.variableArgs) {
|
||||
// Postscript commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf
|
||||
if (argsLength !== numArgs) {
|
||||
@ -4837,8 +4845,7 @@ class EvaluatorPreprocessor {
|
||||
// used to error, rather than just warn, once a number of invalid
|
||||
// path operators have been encountered (fixes bug1443140.pdf).
|
||||
if (
|
||||
fn >= OPS.moveTo &&
|
||||
fn <= OPS.endPath && // Path operator
|
||||
this._isPathOp &&
|
||||
++this._numInvalidPathOPS >
|
||||
EvaluatorPreprocessor.MAX_INVALID_PATH_OPS
|
||||
) {
|
||||
|
1
test/pdfs/issue14917.pdf.link
Normal file
1
test/pdfs/issue14917.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
https://web.archive.org/web/20220515091440/https://pdf.cdn.readpaper.com/spd/2963250244.pdf
|
@ -3016,6 +3016,14 @@
|
||||
},
|
||||
"about": "Need to test *at least* three pages, since the `GlobalImageCache` is involved."
|
||||
},
|
||||
{ "id": "issue14917",
|
||||
"file": "pdfs/issue14917.pdf",
|
||||
"md5": "12201b35853f78a501ac46b91608f8b6",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue1127-text",
|
||||
"file": "pdfs/issue1127.pdf",
|
||||
"md5": "4fb2be5ffefeafda4ba977de2a1bb4d8",
|
||||
|
Loading…
Reference in New Issue
Block a user