Merge pull request #17556 from Snuffleupagus/issue-17554

Ensure that `EvaluatorPreprocessor.opMap` has a null-prototype (issue 17554)
This commit is contained in:
Tim van der Meij 2024-01-21 20:58:09 +01:00 committed by GitHub
commit 49b2d9b5af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 191 additions and 108 deletions

View File

@ -4764,7 +4764,10 @@ class EvaluatorPreprocessor {
//
// If variableArgs === true: [0, `numArgs`] expected
// If variableArgs === false: exactly `numArgs` expected
return shadow(this, "opMap", {
return shadow(
this,
"opMap",
Object.assign(Object.create(null), {
// Graphic state
w: { id: OPS.setLineWidth, numArgs: 1, variableArgs: false },
J: { id: OPS.setLineCap, numArgs: 1, variableArgs: false },
@ -4881,7 +4884,8 @@ class EvaluatorPreprocessor {
nu: null,
nul: null,
null: null,
});
})
);
}
static MAX_INVALID_PATH_OPS = 10;

View File

@ -300,6 +300,7 @@
!helloworld-bad.pdf
!zerowidthline.pdf
!colorspace_cos.pdf
!issue17554.pdf
!issue13242.pdf
!js-colors.pdf
!annotation-line-without-appearance-empty-Rect.pdf

71
test/pdfs/issue17554.pdf Normal file
View File

@ -0,0 +1,71 @@
%PDF-1.4
%%EOF
6 0 obj
<<
/Type /Catalog
/Pages 5 0 R
>>
endobj
1 0 obj
<<
/Type /Page
/Parent 5 0 R
/MediaBox [ 0 0 612 792 ]
/Resources 3 0 R
/Contents 2 0 R
>>
endobj
4 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont/Helvetica
>>
endobj
2 0 obj
<<
/Length 53
>>
stream
toString
endstream
endobj
5 0 obj
<<
/Type /Pages
/Kids [ 1 0 R ]
/Count 1
>>
endobj
3 0 obj
<<
/ProcSet[/PDF/Text]
/Font <</F1 4 0 R >>
>>
endobj
xref
0 7
0000000000 65535 f
0000000060 00000 n
0000000228 00000 n
0000000424 00000 n
0000000145 00000 n
0000000333 00000 n
0000000009 00000 n
trailer
<<
/Size 7
/Root 6 0 R
>>
startxref
488
%%EOF

View File

@ -8762,6 +8762,13 @@
}
}
},
{
"id": "issue17554",
"file": "pdfs/issue17554.pdf",
"md5": "09607e5c6007b28b4e75bf8c38a60de3",
"rounds": 1,
"type": "load"
},
{
"id": "freetexts-delete-editor-print",
"file": "pdfs/freetexts.pdf",